X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=client%2Fsrc%2Fvariants%2FCheckered.js;h=963e013b06dcab0eda5c98e0b16bad6a61f34eeb;hb=8a7741563d38babbebd17ee83c0362a7bc98e9f6;hp=5036a82dbb73bc689018cae03178883b27af8a33;hpb=eb2d61de8d569470fa329a484efe9bab420b2b82;p=vchess.git diff --git a/client/src/variants/Checkered.js b/client/src/variants/Checkered.js index 5036a82d..963e013b 100644 --- a/client/src/variants/Checkered.js +++ b/client/src/variants/Checkered.js @@ -2,6 +2,26 @@ import { ChessRules, Move, PiPo } from "@/base_rules"; export class CheckeredRules extends ChessRules { + static get Options() { + return Object.assign( + {}, + ChessRules.Options, + { + check: [ + { + label: "With switch", + defaut: true, + variable: "switch" + } + ] + } + ); + } + + static AbbreviateOptions(opts) { + return (!opts["switch"] ? "NS" : ""); + } + static board2fen(b) { const checkered_codes = { p: "s", @@ -41,26 +61,6 @@ export class CheckeredRules extends ChessRules { return (b[0] == "c" ? "Checkered/" : "") + b; } - static get Options() { - return Object.assign( - {}, - ChessRules.Options, - { - check: [ - { - label: "With switch", - defaut: true, - variable: "switch" - } - ] - } - ); - } - - static AbbreviateOptions(opts) { - return (!opts["switch"] ? "NS" : ""); - } - setOtherVariables(fen) { super.setOtherVariables(fen); // Local stack of non-capturing checkered moves: @@ -433,12 +433,7 @@ export class CheckeredRules extends ChessRules { isAttackedByKnight(sq, colors) { return this.isAttackedBySlideNJump( - sq, - colors, - V.KNIGHT, - V.steps[V.KNIGHT], - "oneStep" - ); + sq, colors, V.KNIGHT, V.steps[V.KNIGHT], "oneStep"); } isAttackedByBishop(sq, colors) { @@ -448,20 +443,13 @@ export class CheckeredRules extends ChessRules { isAttackedByQueen(sq, colors) { return this.isAttackedBySlideNJump( - sq, - colors, - V.QUEEN, - V.steps[V.ROOK].concat(V.steps[V.BISHOP]) - ); + sq, colors, V.QUEEN, V.steps[V.ROOK].concat(V.steps[V.BISHOP])); } isAttackedByKing(sq, colors) { return this.isAttackedBySlideNJump( - sq, - colors, - V.KING, - V.steps[V.ROOK].concat(V.steps[V.BISHOP]), - "oneStep" + sq, colors, V.KING, + V.steps[V.ROOK].concat(V.steps[V.BISHOP]), "oneStep" ); } @@ -614,7 +602,7 @@ export class CheckeredRules extends ChessRules { } static GenRandInitFen(options) { - const baseFen = ChessRules.GenRandInitFen(options.randomness); + const baseFen = ChessRules.GenRandInitFen(options); return ( // Add 16 pawns flags + empty cmove + stage == 1: baseFen.slice(0, -2) + "1111111111111111 - - 1" +