X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=client%2Fsrc%2Fvariants%2FZen.js;h=bfbc7e29aa6a59aaac19ed0b77002b02c5276a13;hb=4313762da3237b04f204e121a20cab3ba7bb5dd2;hp=eb6748d0d8761f1188932a3c9c5f678435950db7;hpb=7e8a7ea1cb66adb4a987badfb0a3c2f99a21bd0a;p=vchess.git diff --git a/client/src/variants/Zen.js b/client/src/variants/Zen.js index eb6748d0..bfbc7e29 100644 --- a/client/src/variants/Zen.js +++ b/client/src/variants/Zen.js @@ -27,24 +27,6 @@ export class ZenRules extends ChessRules { return undefined; } - // TODO(?): some duplicated code in 2 next functions - getSlideNJumpMoves([x, y], steps, oneStep) { - let moves = []; - outerLoop: for (let loop = 0; loop < steps.length; loop++) { - const step = steps[loop]; - let i = x + step[0]; - let j = y + step[1]; - while (V.OnBoard(i, j) && this.board[i][j] == V.EMPTY) { - moves.push(this.getBasicMove([x, y], [i, j])); - if (oneStep) continue outerLoop; - i += step[0]; - j += step[1]; - } - // No capture check: handled elsewhere (next method) - } - return moves; - } - // follow steps from x,y until something is met. // if met piece is opponent and same movement (asA): eat it! findCaptures_aux([x, y], asA) { @@ -79,6 +61,7 @@ export class ZenRules extends ChessRules { } if ( V.OnBoard(i, j) && + this.board[i][j] != V.EMPTY && this.getColor(i, j) == oppCol && this.getPiece(i, j) == asA ) { @@ -88,7 +71,8 @@ export class ZenRules extends ChessRules { promotionPieces.forEach(p => { moves.push(this.getBasicMove([x, y], [i, j], { c: color, p: p })); }); - } else { + } + else { // All other cases moves.push(this.getBasicMove([x, y], [i, j])); } @@ -108,7 +92,7 @@ export class ZenRules extends ChessRules { return moves; } - canTake(sq1, sq2) { + canTake() { return false; //captures handled separately }