undoMove method
Performs a move
but in reverse order.
Implementation
void undoMove(PlayedMove move) {
_position[move.from.row][move.from.col] = move.promotionTo == null
? _position[move.to.row][move.to.col]
: _position[move.to.row][move.to.col]!.isWhite
? const WhitePawn()
: const BlackPawn();
_position[move.to.row][move.to.col] = move.pieceOnLandingSquare;
}