}
// Some variants do not precompute moves
- get twoSquareMove() {
+ static get TwoSquareMove() {
return false;
}
startPiece.style.opacity = "0.4";
chessboard.style.cursor = "none";
}
- if (!this.twoSquareMove)
+ if (!V.TwoSquareMove)
potentialMoves = this.getPotentialMovesFrom([x, y]);
}
}
const cd =
(landingElt ? this.idToCoords(landingElt.id) : undefined);
if (cd) {
- if (this.twoSquareMove)
+ if (V.TwoSquareMove)
potentialMoves = this.getPotentialMove_s([x, y], [cd.x, cd.y]);
else {
potentialMoves =
get hasEnpassant() {
return false;
}
+
static get HasKing() {
return false;
}
+ static get TwoSquareMove() {
+ return true;
+ }
+
genRandInitBaseFen() {
return {
fen: "sssssssss/sssssssss/sSsS1sSsS/SSSSSSSSS/SSSSSSSSS",
return ''; //never reached
};
-
-// TODO: getPotentialMove_s() + pre-compute atLeastOneCapture() after each opponent move
-
-
getPotentialMovesFrom([x, y], justCapt) {
const oppCol = C.GetOppTurn(this.turn);
const L = this.captures.length;
return (!justCapt ? moves : false);
}
+ getPotentialMove_s([x1, y1], [x2, y2]) {
+ if (
+ Math.abs(x2 - x1) > 1 ||
+ Math.abs(y2 - y1) > 1 ||
+ this.board[x2][y2] != ""
+ ) {
+ return [];
+ }
+ // If canCapture but nothing behind or in front, invalid
+ const step = [x2 - x1, y2 - y1];
+ if (
+ this.canCapture &&
+ ( // TODO...........
+ this.onBoard(x1 - step[0], y1 - step[1]) &&
+ let moves = [];
+
+ }
+
atLeastOneCapture() {
const L = this.captures.length;
if (L > 0) {