5 ms·
Minor point: the FIDE rules[1] state > Article 9: The Drawn Game > ... > 9.2 The game is drawn, upon a correct claim by a player having the move, when th
by JoshuaDavid 3y ago
Minor point: the FIDE rules[1] state
> Article 9: The Drawn Game
> ...
> 9.2 The game is drawn, upon a correct claim by a player having the move, when the same position for at least the third time (not necessarily by a repetition of moves) [happens and a draw is claimed]
> 9.3 The game is drawn, upon a correct claim by a player having the move, if: ... 9.3.2 the last 50 moves by each player have been completed without the movement of any pawn and without any capture.
> ...
> 9.6 If one or both of the following occur(s) then the game is drawn:
> 9.6.1 the same position has appeared, as in 9.2.2 at least five times.
> 9.6.2 any series of at least 75 moves have been made by each player without the movement of any pawn and without any capture. If the last move resulted in checkmate, that shall take precedence.
This means that, in order to store a full chess game-state, you also need to keep track of how many moves since the last pawn move or capture (for the 50 and 75 move rule (9.3.2 and 9.6.2 respectively)) and also what positions have previously occurred (for the 3 / 5 position repeats, (9.2 and 9.6.1 respectively)).
The maximum number of moves from any chess position is 218 according to this post[2], so each move in the history can be uniquely identified by a single byte. You only need to store the moves since the last capture (since you can't repeat an earlier position), and you _definitely_ can't have more than 112 pawn moves without a capture (because there are only 16 pawns and they can only move forward, except in the case of en-passant which requires a different pawn to move forward twice).
But that gives an upper bound of 8400 moves -- this bound is probably much higher than it needs to be though.
----
[1] https://handbook.fide.com/chapter/E012023 https://handbook.fide.com/chapter/E012023
[2] https://www.chess.com/forum/view/fun-with-chess/what-chess-position-has-the-most-number-of-possible-moves?page=2#comment-3532132 https://www.chess.com/forum/view/fun-with-chess/what-chess-p...
- Dylan16807 3y agoIf a pawn moves then you can't repeat a state either, can you? So track the last 75 "moves". > they can only move forward, except in the case of en-passant En passant still attacks forward, into the space the enemy pawn just moved through. > 112 pawn moves without a capture (because there are only 16 pawns and they can only move forward But pawns can't move through pawns. ~~At most I think you can have 4 of the pawns march all the way forward and get captured, leaving you with with 4 pawns that can move 6 spaces and 8 pawns that can move 7 spaces, for a total of 80 pawn moves without a capture.~~ Okay, if you sacrifice a bunch of other pieces to pawns, then you can get them to pair up without losing any. So that's 8 pawns moving 6 spaces, and 8 pawns moving 7 spaces. 104 pawn moves in a row without a capture.
- JoshuaDavid 3y ago> If a pawn moves then you can't repeat a state either, can you? So track the last 75 "moves". You are correct. So the board state from 75 moves previously plus 75 bytes to store the last 75 moves is sufficient to store a chess game state.
- Dylan16807 3y ago150 bytes because "moves" is defined in a very bad way here.