movePiece method

bool movePiece(
  1. Position from,
  2. Position to
)

Moves a piece on the board without validation.

Implementation

bool movePiece(Position from, Position to) {
  ChessPiece? piece = getPiece(from);
  if (piece == null) return false;

  // Move the piece to the new position
  board[to.row][to.col] = piece;
  board[from.row][from.col] = null;

  return true;
}