X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=client%2Fsrc%2Fvariants%2FZen.js;fp=client%2Fsrc%2Fvariants%2FZen.js;h=a6067f9c697c4e4c1de5eddad523a3206f3d6922;hb=9bd6786b863c31c3ccd0057b87cf454c90886056;hp=f5bff8ffd40c8a63d217c80827c1c0db3df9e87b;hpb=0d329b05fd922645ee52e6709d119a002c8aad64;p=vchess.git diff --git a/client/src/variants/Zen.js b/client/src/variants/Zen.js index f5bff8ff..a6067f9c 100644 --- a/client/src/variants/Zen.js +++ b/client/src/variants/Zen.js @@ -28,7 +28,7 @@ export const VariantRules = class ZenRules extends ChessRules { // if met piece is opponent and same movement (asA): eat it! findCaptures_aux([x, y], asA) { const color = this.getColor(x, y); - var moves = []; + let moves = []; const steps = asA != V.PAWN ? asA == V.QUEEN @@ -43,7 +43,7 @@ export const VariantRules = class ZenRules extends ChessRules { [1, -1], [1, 1] ]; - const oneStep = asA == V.KNIGHT || asA == V.PAWN; //we don't capture king + const oneStep = [V.KNIGHT,V.PAWN].includes(asA); //we don't capture king const lastRank = color == "w" ? 0 : V.size.x - 1; const promotionPieces = [V.ROOK, V.KNIGHT, V.BISHOP, V.QUEEN]; outerLoop: for (let loop = 0; loop < steps.length; loop++) { @@ -105,12 +105,13 @@ export const VariantRules = class ZenRules extends ChessRules { [startRank, firstRank].includes(x) && this.board[x + 2 * shift][y] == V.EMPTY ) { - //two squares jump + // Two squares jump moves.push(this.getBasicMove([x, y], [x + 2 * shift, y])); } } - } //promotion + } else { + // Promotion let promotionPieces = [V.ROOK, V.KNIGHT, V.BISHOP, V.QUEEN]; promotionPieces.forEach(p => { // Normal move