projects
/
vchess.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Draft rematch (not working yet) + fix Crazyhouse getPromotedFen()
[vchess.git]
/
client
/
src
/
variants
/
Wormhole.js
diff --git
a/client/src/variants/Wormhole.js
b/client/src/variants/Wormhole.js
index
b04efa9
..
04699b2
100644
(file)
--- a/
client/src/variants/Wormhole.js
+++ b/
client/src/variants/Wormhole.js
@@
-154,16
+154,16
@@
export const VariantRules = class WormholeRules extends ChessRules {
}
}
// Captures
}
}
// 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 (
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]])
) {
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]], {
for (let piece of finalPieces) {
moves.push(
this.getBasicMove([x, y], [sq[0], sq[1]], {
@@
-264,6
+264,8
@@
export const VariantRules = class WormholeRules extends ChessRules {
return this.isAttackedByJump(sq, colors, V.KING, V.steps[V.KING]);
}
return this.isAttackedByJump(sq, colors, V.KING, V.steps[V.KING]);
}
+ // NOTE: altering move in getBasicMove doesn't work and wouldn't be logical.
+ // This is a side-effect on board generated by the move.
static PlayOnBoard(board, move) {
board[move.vanish[0].x][move.vanish[0].y] = V.HOLE;
for (let psq of move.appear) board[psq.x][psq.y] = psq.c + psq.p;
static PlayOnBoard(board, move) {
board[move.vanish[0].x][move.vanish[0].y] = V.HOLE;
for (let psq of move.appear) board[psq.x][psq.y] = psq.c + psq.p;
@@
-293,7
+295,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 =
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);
V.CoordsToSquare(move.start) +
(move.vanish.length > move.appear.length ? "x" : "") +
V.CoordsToSquare(move.end);