X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=client%2Fsrc%2Fvariants%2FMaxima.js;h=d8347ac550cac952f59e95241338a5b1f0be9ee3;hb=cc0f1cbf5844499838d34d7c7342e64e5d33dbe3;hp=e8b15d25d6d18faad65aa9f4a7857cd2c3425b51;hpb=e50a802531b99829c533f22ecd21e359e7e1e049;p=vchess.git diff --git a/client/src/variants/Maxima.js b/client/src/variants/Maxima.js index e8b15d25..d8347ac5 100644 --- a/client/src/variants/Maxima.js +++ b/client/src/variants/Maxima.js @@ -3,6 +3,11 @@ import { ArrayFun } from "@/utils/array"; import { shuffle } from "@/utils/alea"; export class MaximaRules extends ChessRules { + + static get Options() { + return null; + } + static get HasFlags() { return false; } @@ -140,8 +145,9 @@ export class MaximaRules extends ChessRules { // Pre-check: is thing on this square immobilized? const imSq = this.isImmobilized([x, y]); const piece = this.getPiece(x, y); - if (!!imSq && piece != V.KING) { - // Only option is suicide, if I'm not a king: + if (!!imSq) { + if (piece == V.KING) return []; + // Only option is suicide return [ new Move({ start: { x: x, y: y }, @@ -191,7 +197,7 @@ export class MaximaRules extends ChessRules { if (piece == V.KING) j = j % V.size.y; while (V.OnBoard(i, j) && this.board[i][j] == V.EMPTY) { moves.push(this.getBasicMove(initSquare, [i, j])); - if (!!oneStep) continue outerLoop; + if (oneStep) continue outerLoop; i += step[0]; j += step[1]; } @@ -449,14 +455,8 @@ export class MaximaRules extends ChessRules { } getPotentialGuardMoves(sq) { - return ( - this.getSlideNJumpMoves( - sq, - V.steps[V.ROOK].concat(V.steps[V.BISHOP]), - "oneStep", - null - ) - ); + return this.getSlideNJumpMoves( + sq, V.steps[V.ROOK].concat(V.steps[V.BISHOP]), "oneStep"); } getNextMageSteps(step) { @@ -678,15 +678,8 @@ export class MaximaRules extends ChessRules { } isAttackedByGuard(sq, color) { - return ( - super.isAttackedBySlideNJump( - sq, - color, - V.GUARD, - V.steps[V.ROOK].concat(V.steps[V.BISHOP]), - "oneStep" - ) - ); + return super.isAttackedBySlideNJump( + sq, color, V.GUARD, V.steps[V.ROOK].concat(V.steps[V.BISHOP]), 1); } getNextMageCheck(step) { @@ -827,4 +820,5 @@ export class MaximaRules extends ChessRules { if (move.vanish.length > 1 && move.appear[0].p != V.KING) notation += "X"; return notation; } + };