[gnome-chess/mcatanzaro/#47: 2/2] Avoid showing claim draw dialog before forced draw
- From: Michael Catanzaro <mcatanzaro src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-chess/mcatanzaro/#47: 2/2] Avoid showing claim draw dialog before forced draw
- Date: Thu, 15 Oct 2020 14:31:01 +0000 (UTC)
commit 7e3368f278d914a9431f56a70d6bac6dbf99de29
Author: Michael Catanzaro <mcatanzaro gnome org>
Date: Thu Oct 15 09:13:11 2020 -0500
Avoid showing claim draw dialog before forced draw
If we've repeated the same move enough times, we display the claim draw
dialog immediately before ending the game due to the forced draw. This
is wrong: the game is already over, but the user is still prompted to
decide whether to claim draw or not! That's no good.
lib/chess-game.vala | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
---
diff --git a/lib/chess-game.vala b/lib/chess-game.vala
index 154d252..528c9f5 100644
--- a/lib/chess-game.vala
+++ b/lib/chess-game.vala
@@ -249,7 +249,8 @@ public class ChessGame : Object
public bool is_three_fold_repeat ()
{
- return state_repeated_times (current_state) >= 3;
+ var repeated = state_repeated_times (current_state);
+ return repeated == 3 || repeated == 4;
}
public bool is_five_fold_repeat ()
@@ -260,7 +261,7 @@ public class ChessGame : Object
public bool is_fifty_move_rule_fulfilled ()
{
/* Fifty moves *per player* without capture or pawn advancement */
- return current_state.halfmove_clock >= 100;
+ return current_state.halfmove_clock >= 100 && current_state.halfmove_clock < 150;
}
public bool is_seventy_five_move_rule_fulfilled ()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]