X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=client%2Fsrc%2Fvariants%2FWormhole.js;h=462cb3bf426326114e68bd8be436ecfc3abe9d3b;hb=3a2a7b5fd3c6bfd0752838094c27e1fb6172d109;hp=76f6d127ad5de4acff7b6587abd0818fb6c7fb79;hpb=a97bdbda4ecf83645d409b717e36828784d1450d;p=vchess.git diff --git a/client/src/variants/Wormhole.js b/client/src/variants/Wormhole.js index 76f6d127..462cb3bf 100644 --- a/client/src/variants/Wormhole.js +++ b/client/src/variants/Wormhole.js @@ -154,16 +154,16 @@ export const VariantRules = class WormholeRules extends ChessRules { } } // Captures - const finalPieces = x + shiftX == lastRank - ? [V.ROOK, V.KNIGHT, V.BISHOP, V.QUEEN] - : [V.PAWN]; for (let shiftY of [-1, 1]) { const sq = this.getSquareAfter([x,y], [shiftX,shiftY]); if ( - sq && + !!sq && this.board[sq[0]][sq[1]] != V.EMPTY && this.canTake([x, y], [sq[0], sq[1]]) ) { + const finalPieces = sq[0] == lastRank + ? [V.ROOK, V.KNIGHT, V.BISHOP, V.QUEEN] + : [V.PAWN]; for (let piece of finalPieces) { moves.push( this.getBasicMove([x, y], [sq[0], sq[1]], { @@ -278,6 +278,10 @@ export const VariantRules = class WormholeRules extends ChessRules { return this.turn == "w" ? "0-1" : "1-0"; } + static get SEARCH_DEPTH() { + return 2; + } + evalPosition() { let evaluation = 0; for (let i = 0; i < V.size.x; i++) { @@ -295,7 +299,7 @@ export const VariantRules = class WormholeRules extends ChessRules { const piece = this.getPiece(move.start.x, move.start.y); // Indicate start square + dest square, because holes distort the board let notation = - piece.toUpperCase() + + (piece != V.PAWN ? piece.toUpperCase() : "") + V.CoordsToSquare(move.start) + (move.vanish.length > move.appear.length ? "x" : "") + V.CoordsToSquare(move.end);