[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[pbmserv-dev] go: ko detection code finished
I've finished the ko detection code and sent it to Richard. If anyone
would like to review or test it drop me a note.
I only look for ko after a sequence of single stone captures, and
only when the capturing stone is immediately recapturable if not for
ko restrictions. Such sequences are easily reversible, so I play them
backwards and compare with the current board (including whose move it is)
to detect ko. This handles all immediate ko's, triple ko's and many
other cases. Replaying a board from the start to detect or check ko
seems too costly and clumsy -- I didn't want to go that route.
I also generalized this idea to allow passes in the sequence and to work
with more than two players. With two players and no passes, remembering
just the length of the sequence is sufficient. The generalization
requires remembering the identity of the captured stones so the moves
can be reversed.
I needed some new information in game files, so I added a new
ReadWriteIntList Ko. The code handles old game files without a Ko list,
and will add a new Ko list when processing old game files.
Adding a new IntList was one of the few things that was easier than
I thought it would be. The obscurity of the pbmserv code, lack of
comments, and C++ rustiness on my part made some things take many hours
to figure out. But I commented my code, breaking pbmserv tradition:-)
It would have been helpful if game.cpp had a hook for code to execute on
Pass moves. I might add one later, but worked around the problem for now.
Best,
- Scott
P.S.- There's a "Mode" IntList in go which is unused and is always (0).
Does anyone know if there was/is some intended use for this data in
go game files?