X-Git-Url: https://git.auder.net/?p=vchess.git;a=blobdiff_plain;f=client%2Fsrc%2Fvariants%2FArena.js;h=42b1f4af5f998e940a29e26f1c29283174f4d590;hp=b92be1eec4a9802c5dee95762977e97d410f2ca8;hb=d1be804633f9632b35662c0b10743ca50e10030f;hpb=bc06c9bbc9c8ead4ae270204d10f4ff686c764a4 diff --git a/client/src/variants/Arena.js b/client/src/variants/Arena.js index b92be1ee..42b1f4af 100644 --- a/client/src/variants/Arena.js +++ b/client/src/variants/Arena.js @@ -47,15 +47,17 @@ export const VariantRules = class ArenaRules extends ChessRules { moves.push(this.getBasicMove([x, y], [x + 2 * shiftX, y])); } } - // Captures + // Captures: also possible backward for (let shiftY of [-1, 1]) { - if ( - y + shiftY >= 0 && - y + shiftY < sizeY && - this.board[x + shiftX][y + shiftY] != V.EMPTY && - this.canTake([x, y], [x + shiftX, y + shiftY]) - ) { - moves.push(this.getBasicMove([x, y], [x + shiftX, y + shiftY])); + if (y + shiftY >= 0 && y + shiftY < sizeY) { + for (let direction of [-1,1]) { + if ( + this.board[x + direction][y + shiftY] != V.EMPTY && + this.canTake([x, y], [x + direction, y + shiftY]) + ) { + moves.push(this.getBasicMove([x, y], [x + direction, y + shiftY])); + } + } } }