“castlingâ€


Move the king two squares towards the rook. If castling is legal, the rook will move automatically.
The king can’t be in check or travel through check when castling. Neither the king nor rook can move before the castle move.
Assuming the rules of castling are followed and there are no intervening pieces in between the king and the rook-to-castle, we drag the king two spaces to the left or to the right (depending on whether you intend to castle kingside or to castle queenside.
Move the king two squares towards the rook. If castling is legal, the rook will move automatically.
The king can’t be in check or travel through check when castling. Neither the king nor rook can move before the castle move.
And neither can you castle with a newly promoted e8/e1 rook even if this rook and the king have not moved yet.