Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

goboard_slow.py method does_move_violate_ko() Incorrect #34

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

roryheim
Copy link

@roryheim roryheim commented May 7, 2019

I believe the goboard_slow.py from chapter 3 has an error in checking for ko violation. The original code ends up only comparing player and the object id; the object id will always be different, so even when the new board is returned to the state that will violate ko, it won't be detected. The Zobrist code works fine because the hashes are directly compared. So this is minor because most people will want to use Zobrist anyway.

I added a test to the provided test code to prove this bug exists. Try the test against the old code, it should fail.

Arguably I should write a dunder eq for this fix, but I went with this approach first.

@macfergus
Copy link
Collaborator

Good catch, thank you for this fix! Will review this tomorrow

@roryheim
Copy link
Author

roryheim commented May 7, 2019 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants