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

Why do we need zobrist hash code for None? #88

Open fuhaoda opened 3 years ago

fuhaoda commented 3 years ago

Hi, I noticed that from gobroad.py to gobroad_fast.py, when we add or remove a point, we add a new line to remove empty point hash code as below before applying a stone from a player

self._hash^= zobrist.HASH_CODE[point, None]

Is this really necessary since we already code the empty board as 0. After trying only provide black and white stone zobrist hash code for each position, it seems work fine.

Also, in the book listing 3.20, we didn’t generate zobrist code for None as well.

Could you please confirm that adding hash code for None is not necessary? or did I miss something obvious? Haoda