X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=public%2Fjavascripts%2Fvariants%2FLoser.js;h=6a322b9db35730a51a3ead31abbde0b55d868a9b;hb=2eef6db6cdce30fe785e601b88858c7fc743eee8;hp=b4d8b4f0b6aafe052bba0b82311c2ba2192f10e3;hpb=1970e049ee112032977909f5716fc1e5887214d7;p=vchess.git diff --git a/public/javascripts/variants/Loser.js b/public/javascripts/variants/Loser.js index b4d8b4f0..6a322b9d 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]) @@ -24,15 +24,20 @@ class LoserRules extends ChessRules const lastRank = (color == "w" ? 0 : sizeX-1); if (x+shift == lastRank) { - let p = V.KING; // Normal move if (this.board[x+shift][y] == V.EMPTY) - moves.push(this.getBasicMove([x,y], [x+shift,y], {c:color,p:p})); + moves.push(this.getBasicMove([x,y], [x+shift,y], {c:color,p:V.KING})); // Captures - if (y>0 && this.canTake([x,y], [x+shift,y-1]) && this.board[x+shift][y-1] != V.EMPTY) - moves.push(this.getBasicMove([x,y], [x+shift,y-1], {c:color,p:p})); - if (y0 && this.canTake([x,y], [x+shift,y-1]) + && this.board[x+shift][y-1] != V.EMPTY) + { + moves.push(this.getBasicMove([x,y], [x+shift,y-1], {c:color,p:V.KING})); + } + if (y