-
Notifications
You must be signed in to change notification settings - Fork 28
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
Zobrist posstion hash in Chess #36
Comments
Sorry, I was a bit hasty in mapping piece.tpiece.s to a positive range; I should of course have said piece.tpiece.s+NROFTYPES as instead of piece.i . |
Hmm, the posting software here mutilates the posted text, by replacing the multiplication asterisks by switching between plain and italics font. But I hope you get the idea. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I am trying to understand how the "board" hashing works in the context of the Jocly chessbase module. This in order to see what I would have to do to update the key for games involving dropping of captured pieces, so that capture-drop-spanning repetitions will also be correctly detected there.
Am I correct in that the zSign key is the (incrementally updated) XOR of all the 'seeds' for individual (pieceIndex, boardSquare) pairs? (I.e. (piece.i, piece.p)?) This seems wrong, in a way that badly backfires when a given piece can promote and demote, or toggle its color. Even without that it could go wrong: when two pieces of equal type swap places, it considers the positions different, while according to Chess rules it would have to be considered the same. The seeds should really depend on the (colored) piece type and the location (i.e. (piece.t, piece.s, piece.p)), and should be blind to the index the piece happens to have in the piece list.
I suppose this could be fixed by replacing the use of piece.i in the Zobrist.update everywhere by piece.t*(1+piece.s). This would even reduce the number of required seeds from 32 to 18 times the board size, in orthodox Chess, even though 1/3 of the seeds (for piece.s==0) would be wasted; there usually are significantly fewer types than pieces (because there are so many Pawns).
The text was updated successfully, but these errors were encountered: