class ZenRules extends ChessRules
{
// NOTE: enPassant, if enabled, would need to redefine carefully getEpSquare
- static get HasEnpassant { return false; }
+ static get HasEnpassant() { return false; }
// TODO(?): some duplicated code in 2 next functions
getSlideNJumpMoves([x,y], steps, oneStep)
i += step[0];
j += step[1];
}
- if (V.OnBoard(i,j) && this.getColor(i,j) == this.getOppCol(color)
+ if (V.OnBoard(i,j) && this.getColor(i,j) == V.GetOppCol(color)
&& this.getPiece(i,j) == asA)
{
// eat!
const firstRank = (color == 'w' ? sizeY-1 : 0);
const lastRank = (color == "w" ? 0 : sizeY-1);
- if (x+shift >= 0 && x+shift < sizeX && x+shift != lastRank)
+ if (x+shift != lastRank)
{
// Normal moves
if (this.board[x+shift][y] == V.EMPTY)
}
}
- if (x+shift == lastRank)
+ else //promotion
{
- // Promotion
let promotionPieces = [V.ROOK,V.KNIGHT,V.BISHOP,V.QUEEN];
promotionPieces.forEach(p => {
// Normal move
}
}
}
+
+const VariantRules = ZenRules;