X-Git-Url: https://git.auder.net/?p=vchess.git;a=blobdiff_plain;f=client%2Fsrc%2Fvariants%2FArena.js;h=880f0082a97f4fa10f30b4c33c12561ef1f386c4;hp=285dd4c864f7661181df11e2e774d08cd46119a5;hb=4313762da3237b04f204e121a20cab3ba7bb5dd2;hpb=cee75a57d2f4f89c89d64cefbab55d839a238ed9 diff --git a/client/src/variants/Arena.js b/client/src/variants/Arena.js index 285dd4c8..880f0082 100644 --- a/client/src/variants/Arena.js +++ b/client/src/variants/Arena.js @@ -2,6 +2,13 @@ import { ChessRules } from "@/base_rules"; export class ArenaRules extends ChessRules { + static get Lines() { + return [ + [[2, 0], [2, 8]], + [[6, 0], [6, 8]] + ]; + } + static get HasFlags() { return false; } @@ -45,8 +52,8 @@ export class ArenaRules extends ChessRules { scanKings() {} - static GenRandInitFen(randomness) { - return ChessRules.GenRandInitFen(randomness).slice(0, -6) + "-"; + static GenRandInitFen(options) { + return ChessRules.GenRandInitFen(options).slice(0, -6) + "-"; } static InArena(x) { @@ -69,27 +76,13 @@ export class ArenaRules extends ChessRules { } getPotentialQueenMoves(sq) { - return this.getSlideNJumpMoves( - sq, - V.steps[V.ROOK].concat(V.steps[V.BISHOP]) - ).filter(m => { - // Filter out moves longer than 3 squares - return Math.max( - Math.abs(m.end.x - m.start.x), - Math.abs(m.end.y - m.start.y)) <= 3; - }); + return super.getSlideNJumpMoves( + sq, V.steps[V.ROOK].concat(V.steps[V.BISHOP]), 3); } getPotentialKingMoves(sq) { - return this.getSlideNJumpMoves( - sq, - V.steps[V.ROOK].concat(V.steps[V.BISHOP]) - ).filter(m => { - // Filter out moves longer than 3 squares - return Math.max( - Math.abs(m.end.x - m.start.x), - Math.abs(m.end.y - m.start.y)) <= 3; - }); + return super.getSlideNJumpMoves( + sq, V.steps[V.ROOK].concat(V.steps[V.BISHOP]), 3); } getCheckSquares() {