normalizeMove method
Normalize a NormalMove to avoid castling inconsistencies.
The normalized form of a castling move is the king-to-rook move.
This method does not check if the move is legal.
Implementation
Move normalizeMove(NormalMove move) {
final side = _getCastlingSide(move);
if (side == null) return move;
final castlingRook = castles.rookOf(turn, side);
return NormalMove(
from: move.from,
to: castlingRook ?? move.to,
);
}