X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=client%2Fsrc%2Fvariants%2FArena.js;h=9ccd3cc4336672dc94b68ec1da4320b4cddf02a8;hb=6b7b2cf720e6255e4da0dc34fee363c456346a58;hp=b92be1eec4a9802c5dee95762977e97d410f2ca8;hpb=c3a86f018aba40e3926e3672c7cea87acc6d1e25;p=vchess.git diff --git a/client/src/variants/Arena.js b/client/src/variants/Arena.js index b92be1ee..9ccd3cc4 100644 --- a/client/src/variants/Arena.js +++ b/client/src/variants/Arena.js @@ -5,8 +5,10 @@ export const VariantRules = class ArenaRules extends ChessRules { return false; } - static GenRandInitFen() { - return ChessRules.GenRandInitFen().replace("w 1111 -", "w -"); + static GenRandInitFen(randomness) { + return ChessRules + .GenRandInitFen(randomness) + .replace("w 0 1111 -", "w 0 -"); } static InArena(x) { @@ -47,15 +49,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])); + } + } } } @@ -149,4 +153,8 @@ export const VariantRules = class ArenaRules extends ChessRules { } return "*"; } + + static get SEARCH_DEPTH() { + return 4; + } };