X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=public%2Fjavascripts%2Fvariants%2FLoser.js;h=3def40a9c4b0a95f9da6419bf2d342f57c272a1e;hb=0b7d99ecbb5dedc02cd96c457b5fc2962db9b297;hp=6a322b9db35730a51a3ead31abbde0b55d868a9b;hpb=18f9c763d17110b75489f721bf155bb88ac6c5c1;p=vchess.git diff --git a/public/javascripts/variants/Loser.js b/public/javascripts/variants/Loser.js index 6a322b9d..3def40a9 100644 --- a/public/javascripts/variants/Loser.js +++ b/public/javascripts/variants/Loser.js @@ -18,10 +18,8 @@ class LoserRules extends ChessRules // Complete with promotion(s) into king, if possible const color = this.turn; - const V = VariantRules; - const [sizeX,sizeY] = VariantRules.size; const shift = (color == "w" ? -1 : 1); - const lastRank = (color == "w" ? 0 : sizeX-1); + const lastRank = (color == "w" ? 0 : V.size.x-1); if (x+shift == lastRank) { // Normal move @@ -33,7 +31,7 @@ class LoserRules extends ChessRules { moves.push(this.getBasicMove([x,y], [x+shift,y-1], {c:color,p:V.KING})); } - if (y 0) @@ -88,7 +84,7 @@ class LoserRules extends ChessRules let moves = this.filterValid( this.getPotentialMovesFrom(sq) ); // This is called from interface: we need to know if a capture is possible if (this.atLeastOneCapture()) - moves = VariantRules.KeepCaptures(moves); + moves = V.KeepCaptures(moves); return moves; } @@ -96,7 +92,7 @@ class LoserRules extends ChessRules { let moves = super.getAllValidMoves(); if (moves.some(m => { return m.vanish.length == 2; })) - moves = VariantRules.KeepCaptures(moves); + moves = V.KeepCaptures(moves); return moves; }