X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=client%2Fsrc%2Fvariants%2FDark.js;h=cb073cfd7c9b74f8ca742a2da218d6e509657d5b;hb=bc0b9205e41c5db0552e4ccf060b945342e36ed0;hp=3bca23404ecd2dae30dbeff359d9ee21d7c79244;hpb=32f6285ee325a14286562a53baefc647201df2af;p=vchess.git diff --git a/client/src/variants/Dark.js b/client/src/variants/Dark.js index 3bca2340..cb073cfd 100644 --- a/client/src/variants/Dark.js +++ b/client/src/variants/Dark.js @@ -13,6 +13,10 @@ export class DarkRules extends ChessRules { return "none"; } + static get SomeHiddenMoves() { + return true; + } + setOtherVariables(fen) { super.setOtherVariables(fen); const [sizeX, sizeY] = [V.size.x, V.size.y]; @@ -37,16 +41,16 @@ export class DarkRules extends ChessRules { 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) { - const color = this.getColor(i, j); - this.enlightened[color][i][j] = true; + const c = this.getColor(i, j); + this.enlightened[c][i][j] = true; // Add potential squares visible by "impossible pawn capture" if (this.getPiece(i, j) == V.PAWN) { for (let shiftY of [-1, 1]) { if ( - V.OnBoard(i + pawnShift[color], j + shiftY) && - this.board[i + pawnShift[color]][j + shiftY] == V.EMPTY + V.OnBoard(i + pawnShift[c], j + shiftY) && + this.board[i + pawnShift[c]][j + shiftY] == V.EMPTY ) { - this.enlightened[color][i + pawnShift[color]][j + shiftY] = true; + this.enlightened[c][i + pawnShift[c]][j + shiftY] = true; } } } @@ -245,7 +249,8 @@ export class DarkRules extends ChessRules { const myPieceVal = V.VALUES[move.appear[0].p]; const hisPieceVal = V.VALUES[move.vanish[1].p]; // Favor captures - if (myPieceVal <= hisPieceVal) move.eval = hisPieceVal - myPieceVal + 1; + if (myPieceVal <= hisPieceVal) + move.eval = hisPieceVal - myPieceVal + 1; else { // Taking a pawn with minor piece, // or minor piece or pawn with a rook,