▲ 698 ▼ coding chess (lemmy.world) submitted 2 years ago by Tixanou@lemmy.world to c/programmerhumor@lemmy.ml 47 comments fedilink hide all child comments
[–] eatham@aussie.zone 14 points 2 years ago (2 children) Stalemate is after 3 repeat moves, so no. permalink fedilink source parent hideshow 2 child comments replies: [–] my_hat_stinks@programming.dev 10 points 2 years ago It's not just repeated moves, a draw can be called if the board is in the same state 3 times at all during the game; if you get to the same position 3 times using different moves that still counts, even if it was a white move the first two times and a black move the third. The game also ends after 50 moves with no captures or pawn moves so you can't play indefinitely by just avoiding those board states. Interestingly those two moves also make it impossible to return to a previous board state (pawns can't move backwards, extra pieces are never added) so if you're enforcing both rules in code you can safely discard previous board states every time you reset the move counter. permalink fedilink source parent [–] jaybone@lemmy.world 4 points 2 years ago But it’s a state machine, and you could easily contrive scenarios for infinite moves, without stalemate. permalink fedilink source parent
[–] my_hat_stinks@programming.dev 10 points 2 years ago It's not just repeated moves, a draw can be called if the board is in the same state 3 times at all during the game; if you get to the same position 3 times using different moves that still counts, even if it was a white move the first two times and a black move the third. The game also ends after 50 moves with no captures or pawn moves so you can't play indefinitely by just avoiding those board states. Interestingly those two moves also make it impossible to return to a previous board state (pawns can't move backwards, extra pieces are never added) so if you're enforcing both rules in code you can safely discard previous board states every time you reset the move counter. permalink fedilink source parent
[–] jaybone@lemmy.world 4 points 2 years ago But it’s a state machine, and you could easily contrive scenarios for infinite moves, without stalemate. permalink fedilink source parent