+ getPotentialKingMoves(sq) {
+ if (!this.pacoplay) return super.getPotentialKingMoves(sq);
+ // Initialize with normal moves, without captures
+ let moves = [];
+ for (let s of V.steps[V.ROOK].concat(V.steps[V.BISHOP])) {
+ const [i, j] = [sq[0] + s[0], sq[1] + s[1]];
+ if (V.OnBoard(i, j) && this.board[i][j] == V.EMPTY)
+ moves.push(this.getBasicMove(sq, [i, j]));
+ }
+ if (this.castleFlags[this.turn].some(v => v < V.size.y))
+ moves = moves.concat(this.getCastleMoves(sq));
+ return moves;
+ }
+