Fix non-canonical hash after null moves#1095
Merged
codedeliveryservice merged 1 commit intoJul 7, 2026
Merged
Conversation
increment_stack toggles the castling key out on every ply, which is the remove-old-rights half of the pair that make_move completes when it updates castling rights. make_null_move goes through increment_stack but never toggles it back, so the hash after a null move is left off by the castling term: a position reached via a null move hashes differently from the same position parsed from FEN. Move the castling toggle out of the shared increment_stack into make_move, which owns both halves. Null moves now leave castling untouched, matching the standard convention (Stockfish, Viridithas). STC Elo | 3.45 +- 2.88 (95%) SPRT | 8.0+0.08s Threads=1 Hash=16MB LLR | 2.92 (-2.25, 2.89) [-2.75, 0.25] Games | N: 14716 W: 3733 L: 3587 D: 7396 Penta | [43, 1679, 3779, 1803, 54] https://recklesschess.space/test/15402/ LTC Elo | 2.57 +- 2.47 (95%) SPRT | 40.0+0.40s Threads=1 Hash=64MB LLR | 2.91 (-2.25, 2.89) [-2.75, 0.25] Games | N: 17832 W: 4442 L: 4310 D: 9080 Penta | [7, 2002, 4764, 2138, 5] https://recklesschess.space/test/15403/ Bench: 2931707
0be6cd4
into
codedeliveryservice:main
21 checks passed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
increment_stack toggles the castling key out on every ply, which is the remove-old-rights half of the pair that make_move completes when it updates castling rights. make_null_move goes through increment_stack but never toggles it back, so the hash after a null move is left off by the castling term: a position reached via a null move hashes differently from the same position parsed from FEN.
Move the castling toggle out of the shared increment_stack into make_move, which owns both halves. Null moves now leave castling untouched, matching the standard convention (Stockfish, Viridithas).
STC
Elo | 3.45 +- 2.88 (95%)
SPRT | 8.0+0.08s Threads=1 Hash=16MB
LLR | 2.92 (-2.25, 2.89) [-2.75, 0.25]
Games | N: 14716 W: 3733 L: 3587 D: 7396
Penta | [43, 1679, 3779, 1803, 54]
https://recklesschess.space/test/15402/
LTC
Elo | 2.57 +- 2.47 (95%)
SPRT | 40.0+0.40s Threads=1 Hash=64MB
LLR | 2.91 (-2.25, 2.89) [-2.75, 0.25]
Games | N: 17832 W: 4442 L: 4310 D: 9080
Penta | [7, 2002, 4764, 2138, 5]
https://recklesschess.space/test/15403/
Bench: 2931707