[Computer-go] public valid move generator algorithms?

Petr Baudis pasky at ucw.cz
Sun Mar 15 11:08:49 PDT 2015


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?

  (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)

				Petr Baudis
	If you do not work on an important problem, it's unlikely
	you'll do important work.  -- R. Hamming

More information about the Computer-go mailing list