[gnome-chess/gnome-3-8] Fix failure to detect some threefold repetitions
- From: Michael Catanzaro <mcatanzaro src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-chess/gnome-3-8] Fix failure to detect some threefold repetitions
- Date: Sun, 11 Aug 2013 21:00:45 +0000 (UTC)
commit 1aff504ba8081977c11020e4bcfd160a288e0ac4
Author: Michael Catanzaro <mcatanzaro gnome org>
Date: Sun Aug 11 10:23:47 2013 -0500
Fix failure to detect some threefold repetitions
We were considering the value of the previous move in the check for
threefold repetition. But the move is not relevant; the only thing that
matters is that the board state is the same.
src/chess-game.vala | 11 ++---------
1 files changed, 2 insertions(+), 9 deletions(-)
---
diff --git a/src/chess-game.vala b/src/chess-game.vala
index 2a0060b..c896b61 100644
--- a/src/chess-game.vala
+++ b/src/chess-game.vala
@@ -415,21 +415,14 @@ public class ChessState
public bool equals (ChessState state)
{
/* Check first if there is the same layout of pieces (unlikely),
- * then the move castling and en-passant state are the same,
- * then finally that it is the same move */
+ * then that the move castling and en-passant state are the same */
if (piece_masks[Color.WHITE] != state.piece_masks[Color.WHITE] ||
piece_masks[Color.BLACK] != state.piece_masks[Color.BLACK] ||
can_castle_kingside[Color.WHITE] != state.can_castle_kingside[Color.WHITE] ||
can_castle_queenside[Color.WHITE] != state.can_castle_queenside[Color.WHITE] ||
can_castle_kingside[Color.BLACK] != state.can_castle_kingside[Color.BLACK] ||
can_castle_queenside[Color.BLACK] != state.can_castle_queenside[Color.BLACK] ||
- en_passant_index != state.en_passant_index ||
- (last_move != null) != (state.last_move != null) ||
- last_move.piece.type != state.last_move.piece.type ||
- last_move.r0 != state.last_move.r0 ||
- last_move.f0 != state.last_move.f0 ||
- last_move.r1 != state.last_move.r1 ||
- last_move.f1 != state.last_move.f1)
+ en_passant_index != state.en_passant_index)
return false;
/* Finally check the same piece types are present */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]