[Computer-go] public valid move generator algorithms?
holger krekel
holger at merlinux.eu
Sun Mar 15 11:28:11 PDT 2015
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
More information about the Computer-go
mailing list