X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=public%2Fjavascripts%2Fbase_rules.js;h=7c52fc1c47e917438cd6b20e195786da2257169b;hb=1af36beb39aa5d59735483e915fd1040f93eecca;hp=cdd75727f08b77e0dc8c306f42c7a425cd814281;hpb=6037f1d82232e62b669018b548845baf480f9e64;p=vchess.git diff --git a/public/javascripts/base_rules.js b/public/javascripts/base_rules.js index cdd75727..7c52fc1c 100644 --- a/public/javascripts/base_rules.js +++ b/public/javascripts/base_rules.js @@ -710,7 +710,7 @@ class ChessRules ////////////// // END OF GAME - checkGameOver() + checkRepetition() { // 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])) { - 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 "*"; - } // Game over return this.checkGameEnd();