X-Git-Url: https://git.auder.net/?p=vchess.git;a=blobdiff_plain;f=client%2Fsrc%2Fvariants%2FPerfect.js;h=65334e2a65dfd64a272274406b7bf28db47aa8a5;hp=0c5e6e1144d97acc70bfd30e5d7523ff56ddb701;hb=4313762da3237b04f204e121a20cab3ba7bb5dd2;hpb=cee75a57d2f4f89c89d64cefbab55d839a238ed9 diff --git a/client/src/variants/Perfect.js b/client/src/variants/Perfect.js index 0c5e6e11..65334e2a 100644 --- a/client/src/variants/Perfect.js +++ b/client/src/variants/Perfect.js @@ -58,19 +58,19 @@ export class PerfectRules extends ChessRules { getPotentialAmazonMoves(sq) { return super.getPotentialQueenMoves(sq).concat( - this.getSlideNJumpMoves(sq, V.steps[V.KNIGHT], "oneStep") + this.getSlideNJumpMoves(sq, V.steps[V.KNIGHT], 1) ); } getPotentialEmpressMoves(sq) { return this.getSlideNJumpMoves(sq, V.steps[V.ROOK]).concat( - this.getSlideNJumpMoves(sq, V.steps[V.KNIGHT], "oneStep") + this.getSlideNJumpMoves(sq, V.steps[V.KNIGHT], 1) ); } getPotentialPrincessMoves(sq) { return this.getSlideNJumpMoves(sq, V.steps[V.BISHOP]).concat( - this.getSlideNJumpMoves(sq, V.steps[V.KNIGHT], "oneStep") + this.getSlideNJumpMoves(sq, V.steps[V.KNIGHT], 1) ); } @@ -87,39 +87,21 @@ export class PerfectRules extends ChessRules { return ( this.isAttackedBySlideNJump(sq, color, V.AMAZON, V.steps[V.BISHOP]) || this.isAttackedBySlideNJump(sq, color, V.AMAZON, V.steps[V.ROOK]) || - this.isAttackedBySlideNJump( - sq, - color, - V.AMAZON, - V.steps[V.KNIGHT], - "oneStep" - ) + this.isAttackedBySlideNJump(sq, color, V.AMAZON, V.steps[V.KNIGHT], 1) ); } isAttackedByEmpress(sq, color) { return ( this.isAttackedBySlideNJump(sq, color, V.EMPRESS, V.steps[V.ROOK]) || - this.isAttackedBySlideNJump( - sq, - color, - V.EMPRESS, - V.steps[V.KNIGHT], - "oneStep" - ) + this.isAttackedBySlideNJump(sq, color, V.EMPRESS, V.steps[V.KNIGHT], 1) ); } isAttackedByPrincess(sq, color) { return ( this.isAttackedBySlideNJump(sq, color, V.PRINCESS, V.steps[V.BISHOP]) || - this.isAttackedBySlideNJump( - sq, - color, - V.PRINCESS, - V.steps[V.KNIGHT], - "oneStep" - ) + this.isAttackedBySlideNJump(sq, color, V.PRINCESS, V.steps[V.KNIGHT], 1) ); } @@ -134,11 +116,11 @@ export class PerfectRules extends ChessRules { return 2; } - static GenRandInitFen(randomness) { - if (randomness == 0) + static GenRandInitFen(options) { + if (options.randomness == 0) return "esqakbnr/pppppppp/8/8/8/8/PPPPPPPP/ESQAKBNR w 0 ahah -"; - const baseFen = ChessRules.GenRandInitFen(randomness); + const baseFen = ChessRules.GenRandInitFen(options); const fenParts = baseFen.split(' '); const posParts = fenParts[0].split('/');