X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=client%2Fsrc%2Fvariants%2FArena.js;h=620b980ae90cd87984ddc3842f42ab922ab6a3c4;hb=3a2a7b5fd3c6bfd0752838094c27e1fb6172d109;hp=b92be1eec4a9802c5dee95762977e97d410f2ca8;hpb=c3a86f018aba40e3926e3672c7cea87acc6d1e25;p=vchess.git diff --git a/client/src/variants/Arena.js b/client/src/variants/Arena.js index b92be1ee..620b980a 100644 --- a/client/src/variants/Arena.js +++ b/client/src/variants/Arena.js @@ -1,12 +1,12 @@ import { ChessRules } from "@/base_rules"; export const VariantRules = class ArenaRules extends ChessRules { - static get hasFlags() { + static get HasFlags() { return false; } - static GenRandInitFen() { - return ChessRules.GenRandInitFen().replace("w 1111 -", "w -"); + static GenRandInitFen(randomness) { + return ChessRules.GenRandInitFen(randomness).slice(0, -6) + "-"; } static InArena(x) { @@ -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])); + } + } } } @@ -149,4 +151,8 @@ export const VariantRules = class ArenaRules extends ChessRules { } return "*"; } + + static get SEARCH_DEPTH() { + return 4; + } };