X-Git-Url: https://git.auder.net/?p=vchess.git;a=blobdiff_plain;f=client%2Fsrc%2Fvariants%2FCheckered.js;h=aac3e0248531aec7157821eb81ee4f4aa160de86;hp=5036a82dbb73bc689018cae03178883b27af8a33;hb=4313762da3237b04f204e121a20cab3ba7bb5dd2;hpb=cee75a57d2f4f89c89d64cefbab55d839a238ed9 diff --git a/client/src/variants/Checkered.js b/client/src/variants/Checkered.js index 5036a82d..aac3e024 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" ); }