X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=client%2Fsrc%2Fvariants%2FOrdamirror.js;h=21aebaaf00f13407d66a429227a1325cbf4ecb7b;hb=21704b041240cb440d03cfa64a90ed0be6f28415;hp=290ab23d346782aabee01831dd62552de89347f3;hpb=e50a802531b99829c533f22ecd21e359e7e1e049;p=vchess.git diff --git a/client/src/variants/Ordamirror.js b/client/src/variants/Ordamirror.js index 290ab23d..21aebaaf 100644 --- a/client/src/variants/Ordamirror.js +++ b/client/src/variants/Ordamirror.js @@ -3,7 +3,8 @@ import { OrdaRules } from "@/variants/Orda"; import { ArrayFun } from "@/utils/array"; import { randInt } from "@/utils/alea"; -export class DoubleordaRules extends OrdaRules { +export class OrdamirrorRules extends OrdaRules { + static get PawnSpecs() { return Object.assign( {}, @@ -24,14 +25,14 @@ export class DoubleordaRules extends OrdaRules { return "Orda/" + b; } - static GenRandInitFen(randomness) { - if (randomness == 0) + static GenRandInitFen(options) { + if (options.randomness == 0) return "lhafkahl/8/pppppppp/8/8/PPPPPPPP/8/LHAFKAHL w 0 ah -"; let pieces = { w: new Array(8), b: new Array(8) }; // Shuffle pieces on first (and last rank if randomness == 2) for (let c of ["w", "b"]) { - if (c == 'b' && randomness == 1) { + if (c == 'b' && options.randomness == 1) { pieces['b'] = pieces['w']; break; } @@ -105,17 +106,9 @@ export class DoubleordaRules extends OrdaRules { getPotentialFalconMoves(sq) { const onlyMoves = this.getSlideNJumpMoves( - sq, - V.steps[V.ROOK].concat(V.steps[V.BISHOP]), - null, - { onlyMove: true } - ); + sq, V.steps[V.ROOK].concat(V.steps[V.BISHOP]), null, { onlyMove: true }); const onlyTakes = this.getSlideNJumpMoves( - sq, - V.steps[V.KNIGHT], - "oneStep", - { onlyTake: true } - ); + sq, V.steps[V.KNIGHT], "oneStep", { onlyTake: true }); return onlyMoves.concat(onlyTakes); } @@ -132,7 +125,7 @@ export class DoubleordaRules extends OrdaRules { isAttackedByFalcon(sq, color) { return this.isAttackedBySlideNJump( - sq, color, V.FALCON, V.steps[V.KNIGHT], "oneStep"); + sq, color, V.FALCON, V.steps[V.KNIGHT], 1); } static get VALUES() { @@ -145,4 +138,5 @@ export class DoubleordaRules extends OrdaRules { k: 1000 }; } + };