import { randInt } from "@/utils/alea";
export class DynamoRules extends ChessRules {
+
// TODO? later, allow to push out pawns on a and h files
static get HasEnpassant() {
return false;
});
this.amoves.push(move);
}
- this.subTurn = 1;
// Stack "first moves" (on subTurn 1) to merge and check opposite moves
this.firstMove = [];
}
return potentialMoves;
}
- getCurrentScore() {
- if (this.subTurn == 2)
- // Move not over
- return "*";
- return super.getCurrentScore();
- }
-
doClick(square) {
// A click to promote a piece on subTurn 2 would trigger this.
// For now it would then return [NaN, NaN] because surrounding squares
// have no IDs in the promotion modal. TODO: improve this?
- if (!square[0]) return null;
+ if (isNaN(square[0])) return null;
// If subTurn == 2 && square is empty && !underCheck && !isOpposite,
// then return an empty move, allowing to "pass" subTurn2
const La = this.amoves.length;
play(move) {
move.flags = JSON.stringify(this.aggregateFlags());
V.PlayOnBoard(this.board, move);
+ // NOTE; if subTurn == 1, there may be no available moves at subTurn == 2.
+ // However, it's quite easier to wait for a user click.
if (this.subTurn == 2) {
const L = this.firstMove.length;
this.amoves.push(this.getAmove(this.firstMove[L-1], move));
return initialSquare + "R";
return move.appear[0].p.toUpperCase() + initialSquare + finalSquare;
}
+
};