X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=client%2Fsrc%2Fvariants%2FHidden.js;h=8a5858ea147816d0fc52f544d9c6ad850b42e5f4;hb=c583ef1c1dfd19aee88b22c2175202fbdf4dc1c0;hp=046fe99e02d55fcc68931d3bff6639bd02b88750;hpb=57eb158fe8e37daaae11685df846003cda4aba19;p=vchess.git diff --git a/client/src/variants/Hidden.js b/client/src/variants/Hidden.js index 046fe99e..8a5858ea 100644 --- a/client/src/variants/Hidden.js +++ b/client/src/variants/Hidden.js @@ -7,6 +7,10 @@ export const VariantRules = class HiddenRules extends ChessRules { return false; } + static get HasCastle() { + return false; + } + static get HasEnpassant() { return false; } @@ -74,7 +78,7 @@ export const VariantRules = class HiddenRules extends ChessRules { } // Scan board for kings positions (no castling) - scanKingsRooks(fen) { + scanKings(fen) { this.kingPos = { w: [-1, -1], b: [-1, -1] }; const fenRows = V.ParseFen(fen).position.split("/"); for (let i = 0; i < fenRows.length; i++) { @@ -143,16 +147,6 @@ export const VariantRules = class HiddenRules extends ChessRules { return mv; } - // What are the king moves from square x,y ? - getPotentialKingMoves(sq) { - // No castling: - return this.getSlideNJumpMoves( - sq, - V.steps[V.ROOK].concat(V.steps[V.BISHOP]), - "oneStep" - ); - } - filterValid(moves) { return moves; } @@ -225,8 +219,8 @@ export const VariantRules = class HiddenRules extends ChessRules { return []; } - updateVariables(move) { - super.updateVariables(move); + postPlay(move) { + super.postPlay(move); if ( move.vanish.length >= 2 && [V.KING,V.HIDDEN_CODE[V.KING]].includes(move.vanish[1].p) @@ -236,8 +230,8 @@ export const VariantRules = class HiddenRules extends ChessRules { } } - unupdateVariables(move) { - super.unupdateVariables(move); + postUndo(move) { + super.postUndo(move); const c = move.vanish[0].c; const oppCol = V.GetOppCol(c); if (this.kingPos[oppCol][0] < 0)