projects
/
vchess.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
First draft of Magnetic chess
[vchess.git]
/
public
/
javascripts
/
base_rules.js
diff --git
a/public/javascripts/base_rules.js
b/public/javascripts/base_rules.js
index
cdd7572
..
7c52fc1
100644
(file)
--- a/
public/javascripts/base_rules.js
+++ b/
public/javascripts/base_rules.js
@@
-710,7
+710,7
@@
class ChessRules
//////////////
// END OF GAME
//////////////
// END OF GAME
- check
GameOver
()
+ check
Repetition
()
{
// Check for 3 repetitions
if (this.moves.length >= 8)
{
// Check for 3 repetitions
if (this.moves.length >= 8)
@@
-722,15
+722,19
@@
class ChessRules
_.isEqual(this.moves[L-3], this.moves[L-7]) &&
_.isEqual(this.moves[L-4], this.moves[L-8]))
{
_.isEqual(this.moves[L-3], this.moves[L-7]) &&
_.isEqual(this.moves[L-4], this.moves[L-8]))
{
- return
"1/2 (repetition)"
;
+ return
true
;
}
}
}
}
+ return false;
+ }
- if (this.atLeastOneMove())
- {
- // game not over
+ checkGameOver()
+ {
+ if (this.checkRepetition())
+ return "1/2";
+
+ if (this.atLeastOneMove()) // game not over
return "*";
return "*";
- }
// Game over
return this.checkGameEnd();
// Game over
return this.checkGameEnd();