X-Git-Url: https://git.auder.net/?p=vchess.git;a=blobdiff_plain;f=client%2Fsrc%2Fvariants%2FTencubed.js;h=11270b21d82918c64b54b5876f1355e1a16f7be1;hp=af48977ea2911f6bf74a19f47274586e844bb38b;hb=4313762da3237b04f204e121a20cab3ba7bb5dd2;hpb=cee75a57d2f4f89c89d64cefbab55d839a238ed9 diff --git a/client/src/variants/Tencubed.js b/client/src/variants/Tencubed.js index af48977e..11270b21 100644 --- a/client/src/variants/Tencubed.js +++ b/client/src/variants/Tencubed.js @@ -60,8 +60,6 @@ export class TencubedRules extends ChessRules { static get steps() { return Object.assign( - {}, - ChessRules.steps, { w: [ [-3, -1], @@ -91,12 +89,13 @@ export class TencubedRules extends ChessRules { [2, 0], [0, 2] ] - } + }, + ChessRules.steps, ); } - static GenRandInitFen(randomness) { - if (randomness == 0) { + static GenRandInitFen(options) { + if (options.randomness == 0) { return ( "2cwamwc2/1rnbqkbnr1/pppppppppp/91/91/" + "91/91/PPPPPPPPPP/1RNBQKBNR1/2CWAMWC2/ " + @@ -104,7 +103,7 @@ export class TencubedRules extends ChessRules { ); } - const baseFen = V.ParseFen(ChessRules.GenRandInitFen(randomness)); + const baseFen = V.ParseFen(ChessRules.GenRandInitFen(options)); const positionParts = baseFen.position.split("/"); const bFen = ( "1" + positionParts[0] + @@ -164,22 +163,22 @@ export class TencubedRules extends ChessRules { getPotentialMarshallMoves(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) ); } getPotentialArchbishopMoves(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) ); } getPotentialChampionMoves(sq) { - return this.getSlideNJumpMoves(sq, V.steps[V.CHAMPION], "oneStep"); + return this.getSlideNJumpMoves(sq, V.steps[V.CHAMPION], 1); } getPotentialWizardMoves(sq) { - return this.getSlideNJumpMoves(sq, V.steps[V.WIZARD], "oneStep"); + return this.getSlideNJumpMoves(sq, V.steps[V.WIZARD], 1); } isAttacked(sq, color) { @@ -195,41 +194,28 @@ export class TencubedRules extends ChessRules { isAttackedByMarshall(sq, color) { return ( this.isAttackedBySlideNJump(sq, color, V.MARSHALL, V.steps[V.ROOK]) || - this.isAttackedBySlideNJump( - sq, - color, - V.MARSHALL, - V.steps[V.KNIGHT], - "oneStep" - ) + this.isAttackedBySlideNJump(sq, color, V.MARSHALL, V.steps[V.KNIGHT], 1) ); } isAttackedByArchbishop(sq, color) { return ( - this.isAttackedBySlideNJump(sq, color, V.ARCHBISHOP, V.steps[V.BISHOP]) || this.isAttackedBySlideNJump( - sq, - color, - V.ARCHBISHOP, - V.steps[V.KNIGHT], - "oneStep" - ) + sq, color, V.ARCHBISHOP, V.steps[V.BISHOP]) + || + this.isAttackedBySlideNJump( + sq, color, V.ARCHBISHOP, V.steps[V.KNIGHT], 1) ); } isAttackedByWizard(sq, color) { - return ( - this.isAttackedBySlideNJump( - sq, color, V.WIZARD, V.steps[V.WIZARD], "oneStep") - ); + return this.isAttackedBySlideNJump( + sq, color, V.WIZARD, V.steps[V.WIZARD], 1); } isAttackedByChampion(sq, color) { - return ( - this.isAttackedBySlideNJump( - sq, color, V.CHAMPION, V.steps[V.CHAMPION], "oneStep") - ); + return this.isAttackedBySlideNJump( + sq, color, V.CHAMPION, V.steps[V.CHAMPION], 1); } static get SEARCH_DEPTH() { @@ -238,9 +224,13 @@ export class TencubedRules extends ChessRules { static get VALUES() { return Object.assign( - {}, - ChessRules.VALUES, - { c: 4, w: 3, a: 6, m: 8 } + { + c: 4, + w: 3, + a: 6, + m: 8 + }, + ChessRules.VALUES ); }