Allow fifty-move claim ahead of a checkmating or stalemating move#1193
Open
Booyaka101 wants to merge 1 commit into
Open
Allow fifty-move claim ahead of a checkmating or stalemating move#1193Booyaka101 wants to merge 1 commit into
Booyaka101 wants to merge 1 commit into
Conversation
can_claim_fifty_moves() pushed each non-zeroing legal move and tested the result with is_fifty_moves(), which is False when the resulting position has no legal moves. A move that completes the 100 halfmoves but also gives checkmate or stalemate was therefore rejected. Under FIDE 9.3 the claim is made ahead of the move: the player only declares a non-pawn, non-capture move that completes the count; it is not played, so its being game-ending does not invalidate the claim. With the clock at 99 any non-zeroing legal move completes the count, so the push/is_fifty_moves() test becomes a direct check. Positions that are already checkmate or stalemate still return False (no legal moves to iterate). Closes niklasf#1188.
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.
Closes #1188.
can_claim_fifty_moves()pushed each non-zeroing legal move and tested the result withis_fifty_moves(), which is False when the resulting position has no legal moves. A move that completes the 100 halfmoves but also gives checkmate or stalemate was therefore rejected.Under FIDE 9.3 the claim is made ahead of the move: the player declares a non-pawn, non-capture move that completes the count; it is not played, so its being game-ending does not invalidate the claim (confirmed in the issue thread by an FA, an IA and a National Arbiter). With the clock at 99 any non-zeroing legal move completes the count, so the push/
is_fifty_moves()test becomes a direct check. Positions that are already checkmate or stalemate still return False (no legal moves to iterate), so the existing "too late to claim" tests are unchanged.Reproducer from the issue now returns True; added a regression test. Full suite (291 tests) and
mypy --strict chess/pyright chesspass.