X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=client%2Fsrc%2Fvariants%2FDoublearmy.js;h=87d262a62ee98d00353e136b3753a794b1728138;hb=4313762da3237b04f204e121a20cab3ba7bb5dd2;hp=0fafe96fbf760f3382fb87913ee74df2a48daaee;hpb=de3f56254c410a7c245a50053b7c905233b58115;p=vchess.git diff --git a/client/src/variants/Doublearmy.js b/client/src/variants/Doublearmy.js index 0fafe96f..87d262a6 100644 --- a/client/src/variants/Doublearmy.js +++ b/client/src/variants/Doublearmy.js @@ -3,9 +3,10 @@ import { ChessRules } from "@/base_rules"; // Ideas with 2 kings: // Stage 1 {w, b} : 2 kings on board, value 5. // Stage 2: only one, get mated and all that, value 1000 -// ...But the middle king will get captured quickly... +// ...But the middle king will be captured quickly... export class DoublearmyRules extends ChessRules { + static get COMMONER() { return "c"; } @@ -18,8 +19,8 @@ export class DoublearmyRules extends ChessRules { return (b[1] == V.COMMONER ? "Doublearmy/" : "") + b; } - static GenRandInitFen(randomness) { - const fen = ChessRules.GenRandInitFen(randomness); + static GenRandInitFen(options) { + const fen = ChessRules.GenRandInitFen(options); const rows = fen.split(" ")[0].split("/"); return ( rows[0] + "/" + @@ -44,10 +45,7 @@ export class DoublearmyRules extends ChessRules { getPotentialCommonerMoves(sq) { return this.getSlideNJumpMoves( - sq, - V.steps[V.ROOK].concat(V.steps[V.BISHOP]), - "oneStep" - ); + sq, V.steps[V.ROOK].concat(V.steps[V.BISHOP]), 1); } isAttacked(sq, color) { @@ -59,23 +57,18 @@ export class DoublearmyRules extends ChessRules { isAttackedByCommoner(sq, color) { return this.isAttackedBySlideNJump( - sq, - color, - V.COMMONER, - V.steps[V.ROOK].concat(V.steps[V.BISHOP]), - "oneStep" - ); + sq, color, V.COMMONER, V.steps[V.ROOK].concat(V.steps[V.BISHOP]), 1); } static get VALUES() { return Object.assign( - {}, - ChessRules.VALUES, - { c: 5 } + { c: 5 }, + ChessRules.VALUES ); } static get SEARCH_DEPTH() { return 2; } + };