maxpumperla / deep_learning_and_the_game_of_go

Code and other material for the book "Deep Learning and the Game of Go"
https://www.manning.com/books/deep-learning-and-the-game-of-go
953 stars 387 forks source link

Correcting _remove_string to fix ko detection #22

Closed Efaq closed 5 years ago

Efaq commented 5 years ago

Given a specific board state, if one piece is placed and then removed, the initial and final board configurations are the same, but in the dictionary _grid of the first one there will be no entry for the Point where the stone was placed, while in the _grid of the second one there will be an entry pointing to None. This makes the equality check of situation for ko to return False, since the dictionaries are different, but the states are the same and there should be a ko. I came across examples of this behavior.

In goboard_slow.py, in the _remove_string method, the last line is changed so the whole key is deleted instead of it being linked to None.

Before submitting a pull request, note that master and the respective chapter branches need to stay in sync with the print version of the book.

Should your current PR mix these types of changes, please consider to split it accordingly. Thank you!

maxpumperla commented 5 years ago

thanks