- // Does this move turn off a 2-squares pawn flag?
- if (
- move.vanish[0].p == V.PAWN ||
- (
- !(ChessRules.PIECES.includes(move.vanish[0].p)) &&
- this.getUnionPieces(move.vanish[0].c, move.vanish[0].p)[c] == V.PAWN
- )
- ) {
- this.pawnFlags[move.start.x == 6 ? "w" : "b"][move.start.y] = false;
- }
+ // This move turns off a 2-squares pawn flag
+ this.pawnFlags[c][move.start.y] = false;
+ }
+ }
+
+ play(move) {
+ move.flags = JSON.stringify(this.aggregateFlags());
+ this.prePlay(move);
+ this.epSquares.push(this.getEpSquare(move));
+ // Check if the move is the last of the turn: all cases except releases
+ if (!move.end.released) {
+ // No more union releases available
+ this.turn = V.GetOppCol(this.turn);
+ this.movesCount++;
+ this.lastMoveEnd.push(null);
+ }
+ else {
+ this.lastMoveEnd.push({
+ p: move.end.released,
+ x: move.end.x,
+ y: move.end.y
+ });
+ }
+ V.PlayOnBoard(this.board, move);
+ this.umoves.push(this.getUmove(move));
+ if (!move.end.released) this.repetitions = [];
+ else {
+ this.repetitions.push(
+ {
+ piece: move.end.released,
+ square: { x: move.end.x, y: move.end.y },
+ position: this.getBaseFen()
+ }
+ );