X-Git-Url: https://git.auder.net/assets/img/logo_Westcastle.png?a=blobdiff_plain;f=public%2Fjavascripts%2Fbase_rules.js;h=7c52fc1c47e917438cd6b20e195786da2257169b;hb=1af36beb39aa5d59735483e915fd1040f93eecca;hp=8626b8888f0d4b6a7acbd7fa97545652dc5a0caf;hpb=204e289bbcddc69e2d81aef492dbea6db9e31188;p=vchess.git diff --git a/public/javascripts/base_rules.js b/public/javascripts/base_rules.js index 8626b888..7c52fc1c 100644 --- a/public/javascripts/base_rules.js +++ b/public/javascripts/base_rules.js @@ -65,37 +65,37 @@ class ChessRules const position = fenParts[0].split("/"); for (let i=0; i 0 ? this.getEpSquare(this.lastMove) : undefined; @@ -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();