You can keep track of "pseudo-liberties", where you count a liberty multiple times if it is adjacent to multiple stones in a chain. That seems to be the easiest way to implement it, although a serious program will eventually need the actual liberty count, so perhaps you should just do that from the beginning.
Álvaro. On Sunday, March 15, 2015, holger krekel <hol...@merlinux.eu> wrote: > Hi Petr, > > On Sun, Mar 15, 2015 at 19:08 +0100, Petr Baudis wrote: > > Hi! > > > > On Sun, Mar 15, 2015 at 03:18:46PM +0000, holger krekel wrote: > > > could anyone point me to a current good public source algorithm > > > for generating valid moves from a given Go board position? > > > > > > All else failing, i am going to analyze Gnugo first (board.c mostly) > > > but wanted to ask for hints here first. I am mostly interested in > > > readability of the algorithm, not speed, at this point. So high-level > > > language implementations are fine. > > > > Well, any open source Go program should be able to do the job, > > in principle. But it's also a little unclear for me exactly what > > are you asking for. In principle, the algorithm is > > > > for point in board.empty_points(): > > if board.play(point) is ok: > > # Not a suicide or ko violation > > yield point > > > > ...but I guess you are asking for something more/else? > > I am particularly interested in the implementation of the comment > ("suicide"). > It seems you need to track stone strings and their liberties to properly > determine if something is a suicide move. Determining Ko-status is > comparatively easy (superko or avoiding board repetetitions is a > different matter). > > > (If you are interested in Python, there are various Go implementations > > in it. I'm working on > https://github.com/pasky/michi/blob/master/michi.py) > > thanks for the link! > > holger > > -- > about me: http://holgerkrekel.net/about-me/ > contracting: http://merlinux.eu > _______________________________________________ > Computer-go mailing list > Computer-go@computer-go.org <javascript:;> > http://computer-go.org/mailman/listinfo/computer-go
_______________________________________________ Computer-go mailing list Computer-go@computer-go.org http://computer-go.org/mailman/listinfo/computer-go