return moves;
}
+ getPotentialKingMoves(sq) {
+ let moves = this.getSlideNJumpMoves(
+ sq,
+ V.steps[V.ROOK].concat(V.steps[V.BISHOP]),
+ "oneStep"
+ );
+ const c = this.turn;
+ const oppCol = V.GetOppCol(c);
+ if (
+ !this.isAttacked(this.kingPos[c], oppCol) &&
+ this.castleFlags[c].some(v => v < V.size.y)
+ ) {
+ moves = moves.concat(super.getCastleMoves(sq, null, true));
+ }
+ return moves;
+ }
+
getEpSquare(moveOrSquare) {
if (typeof moveOrSquare === "string") {
const square = moveOrSquare;
}
play(move) {
+ move.flags = JSON.stringify(this.aggregateFlags());
this.epSquares.push(this.getEpSquare(move));
// Check if the move is the last of the turn: all cases except releases
if (!move.released) {
undo(move) {
this.epSquares.pop();
+ this.disaggregateFlags(JSON.parse(move.flags));
V.UndoOnBoard(this.board, move);
this.lastMoveEnd.pop();
if (!move.released) {