[gnome-chess] trivial: move methods related to claim draw
- From: Michael Catanzaro <mcatanzaro src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-chess] trivial: move methods related to claim draw
- Date: Wed, 9 Apr 2014 03:47:30 +0000 (UTC)
commit cc04b52312955dbf75b826e53ddfeb3ef58ffed0
Author: Michael Catanzaro <mcatanzaro gnome org>
Date: Tue Apr 8 22:46:37 2014 -0500
trivial: move methods related to claim draw
lib/chess-game.vala | 48 ++++++++++++++++++++++++------------------------
1 files changed, 24 insertions(+), 24 deletions(-)
---
diff --git a/lib/chess-game.vala b/lib/chess-game.vala
index 10d628e..82c98a9 100644
--- a/lib/chess-game.vala
+++ b/lib/chess-game.vala
@@ -212,6 +212,30 @@ public class ChessGame
return true;
}
+ private int state_repeated_times (ChessState s1)
+ {
+ var count = 1;
+
+ foreach (var s2 in move_stack)
+ {
+ if (s1 != s2 && s1.equals (s2))
+ count++;
+ }
+
+ return count;
+ }
+
+ public bool is_three_fold_repeat ()
+ {
+ foreach (var state in move_stack)
+ {
+ if (state_repeated_times (state) >= 3)
+ return true;
+ }
+
+ return false;
+ }
+
public bool is_fifty_move_rule_fulfilled ()
{
/* Fifty moves per player without capture or pawn advancement */
@@ -304,28 +328,4 @@ public class ChessGame
_clock.stop();
ended ();
}
-
- public bool is_three_fold_repeat ()
- {
- foreach (var state in move_stack)
- {
- if (state_repeated_times (state) >= 3)
- return true;
- }
-
- return false;
- }
-
- private int state_repeated_times (ChessState s1)
- {
- var count = 1;
-
- foreach (var s2 in move_stack)
- {
- if (s1 != s2 && s1.equals (s2))
- count++;
- }
-
- return count;
- }
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]