Skip to content

Allow fifty-move claim ahead of a checkmating or stalemating move#1193

Open
Booyaka101 wants to merge 1 commit into
niklasf:masterfrom
Booyaka101:fix/1188-fifty-move-claim-ahead
Open

Allow fifty-move claim ahead of a checkmating or stalemating move#1193
Booyaka101 wants to merge 1 commit into
niklasf:masterfrom
Booyaka101:fix/1188-fifty-move-claim-ahead

Conversation

@Booyaka101
Copy link
Copy Markdown

Closes #1188.

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 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 chess pass.

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

claim-ahead rejects valid moves that deliver checkmate (or stalemate)

1 participant