From: Benjamin Auder Date: Sat, 8 Dec 2018 02:28:01 +0000 (+0100) Subject: Fix a detail in Loser's flags X-Git-Url: https://git.auder.net/doc/html/css/scripts/vendor/%3C?a=commitdiff_plain;h=77e1ec78ec91089a80bf806667da76826eefd94d;p=vchess.git Fix a detail in Loser's flags --- diff --git a/public/javascripts/base_rules.js b/public/javascripts/base_rules.js index ee5ddd02..172f68b4 100644 --- a/public/javascripts/base_rules.js +++ b/public/javascripts/base_rules.js @@ -1076,7 +1076,7 @@ class ChessRules for (let i of ['w','b']) { for (let j=0; j<2; j++) - fen += this.castleFlags[i][j] ? '1' : '0'; + fen += (this.castleFlags[i][j] ? '1' : '0'); } return fen; } diff --git a/public/javascripts/variants/Loser.js b/public/javascripts/variants/Loser.js index b4d8b4f0..936c2590 100644 --- a/public/javascripts/variants/Loser.js +++ b/public/javascripts/variants/Loser.js @@ -9,7 +9,7 @@ class LoserRules extends ChessRules setFlags(fen) { // No castling, hence no flags; but flags defined for compatibility - this.castleFlags = "0000"; + this.castleFlags = { "w":[false,false], "b":[false,false] }; } getPotentialPawnMoves([x,y]) @@ -110,6 +110,11 @@ class LoserRules extends ChessRules unupdateVariables(move) { } parseFlags(flags) { } + getFlagsFen() + { + return ""; + } + checkGameEnd() { // No valid move: you win!