X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=client%2Fsrc%2Fvariants%2FHypnotic.js;h=3b678433686a97976ee57c020389dcd227f4d2d6;hb=HEAD;hp=130b12790f1f0c35464c48987e8e863de775462c;hpb=2fac4d67083700a1f1e85ed8662c176c24cdea6b;p=vchess.git diff --git a/client/src/variants/Hypnotic.js b/client/src/variants/Hypnotic.js index 130b1279..3b678433 100644 --- a/client/src/variants/Hypnotic.js +++ b/client/src/variants/Hypnotic.js @@ -23,8 +23,8 @@ export class HypnoticRules extends ChessRules { ); } - static GenRandInitFen(randomness) { - return ChessRules.GenRandInitFen(randomness) + " -"; + static GenRandInitFen(options) { + return ChessRules.GenRandInitFen(options) + " -"; } setOtherVariables(fen) { @@ -69,11 +69,26 @@ export class HypnoticRules extends ChessRules { this.getPiece(x, y) == V.KING // No castling with enemy king (...yes, should eat it but...) ? super.getSlideNJumpMoves( - [x, y], V.steps[V.ROOK].concat(V.steps[V.BISHOP]), "oneStep") + [x, y], V.steps[V.ROOK].concat(V.steps[V.BISHOP]), 1) : super.getPotentialMovesFrom([x, y]); return moves; } + getAllPotentialMoves() { + let potentialMoves = []; + for (let i = 0; i < V.size.x; i++) { + for (let j = 0; j < V.size.y; j++) { + if (this.board[i][j] != V.EMPTY) { + Array.prototype.push.apply( + potentialMoves, + this.getPotentialMovesFrom([i, j]) + ); + } + } + } + return potentialMoves; + } + getEnpassantCaptures([x, y], shiftX) { const Lep = this.epSquares.length; const epSquare = this.epSquares[Lep - 1]; //always at least one element