Closed fredthedead closed 5 years ago
In the following code section it seems like the ko detection/search is traversing all past moves:
Isn't ko limited only to the previous move? (so the
while
should be replaced byif
?)
Hi fredthedead, checkout my PR from about 18 days ago. My fix fixes this issue you observed. I don't note that in my PR, however due to the original comparison bug, if you only use an 'if', there's still a bigger bug in that a ko violation will never be found. I verified via unit tests that my fix only looks back one board and if ko violation occurs it will be detected. Once the author transitioned to the hashing method, his original code then works fine. https://github.com/maxpumperla/deep_learning_and_the_game_of_go/pull/34/commits/5d0fde79b5f1b52d458a5f63463c4737e9e18bb1
Hi @roryheim, thanks for replying! I've looked at your PR, with that change - would it still look back at more than a single state? If so, is that needed? I thought ko is only defined on two consecutive states
@fredthedead technically ko can be defined by disallowing the exact same board position twice, i.e. the board you reach with the current move can't be the same as any of the previous board states. In practice, it's usually enough to look at your last move, but I'm sure you can cook up an artificial example in which black and white take a bunch of stones from each other to end up where they were 40 moves ago. that would be ko.
looking up hash values in a hashmap is cheap, so we do that in the Zobrist implementation of GoBoard.
In the following code section it seems like the ko detection/search is traversing all past moves: https://github.com/maxpumperla/deep_learning_and_the_game_of_go/blob/61328b8f0c0e54870bd95d6ace7f9641acf1247b/code/dlgo/goboard_slow.py#L216
Isn't ko limited only to the previous move? (so the
while
should be replaced byif
?)