X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=public%2Fjavascripts%2Fvariants%2FCheckered.js;h=3626822bfbfed1ef2cc538a0931c90d8a57a65e1;hb=d3334c3a9ee5edc9412d2c95adfc752b72057168;hp=7c00ccacfa798dac1dc87bbe956d6d10d600a8cc;hpb=f3802fcd1279e5d07cdff1341fc5e17c5296dc9c;p=vchess.git diff --git a/public/javascripts/variants/Checkered.js b/public/javascripts/variants/Checkered.js index 7c00ccac..3626822b 100644 --- a/public/javascripts/variants/Checkered.js +++ b/public/javascripts/variants/Checkered.js @@ -276,8 +276,8 @@ class CheckeredRules extends ChessRules canIplay(color, sq) { - return ((color=='w' && this.movesCount%2==0) || color=='c' - || (color=='b' && this.movesCount%2==1)) + return ((color=='w' && this.moves.length%2==0) || color=='c' + || (color=='b' && this.moves.length%2==1)) && [color,'c'].includes(this.getColor(sq[0], sq[1])); } @@ -385,19 +385,6 @@ class CheckeredRules extends ChessRules this.flags[1][move.start.x==6 ? "w" : "b"][move.start.y] = false; } - play(move, ingame) - { - super.play(move, ingame); - if (!ingame) - this.moves.push(move); //needed for turn indication for checkered pieces - } - - undo(move) - { - super.undo(move); - this.moves.pop(); - } - checkGameEnd(color) { if (!this.isAttacked(this.kingPos[color], this.getOppCol(color))