X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=public%2Fjavascripts%2Fvariants%2FZen.js;h=96dd8f9f72d09f6fc08c74696cbe34be57232e15;hb=33ee191669b40afbd03d8fbf5406382fa2de1bf9;hp=d9e22947478ce1d9184adaef97e48f0af1d7f92e;hpb=4b5fe3061829e184f9ad86a13d831eda22d95343;p=vchess.git diff --git a/public/javascripts/variants/Zen.js b/public/javascripts/variants/Zen.js index d9e22947..96dd8f9f 100644 --- a/public/javascripts/variants/Zen.js +++ b/public/javascripts/variants/Zen.js @@ -1,5 +1,11 @@ class ZenRules extends ChessRules { + // NOTE: enPassant, if enabled, would need to redefine carefully getEpSquare + getEpSquare(move) + { + return undefined; + } + // TODO: some duplicated code in 2 next functions getSlideNJumpMoves(x, y, color, steps, oneStep) { @@ -135,21 +141,7 @@ class ZenRules extends ChessRules }); } - // En passant - const Lep = this.epSquares.length; - const epSquare = Lep>0 ? this.epSquares[Lep-1] : undefined; - if (!!epSquare && epSquare.x == x+shift && Math.abs(epSquare.y - y) == 1) - { - let epStep = epSquare.y - y; - var enpassantMove = this.getBasicMove(x, y, x+shift, y+epStep); - enpassantMove.vanish.push({ - x: x, - y: y+epStep, - p: 'p', - c: this.getColor(x,y+epStep) - }); - moves.push(enpassantMove); - } + // No en passant here // Add "zen" captures Array.prototype.push.apply(moves, this.findCaptures(x, y, color));