# Castling
Castling consists of moving the king two squares towards a rook,
then placing the rook on the other side of the king, adjacent to it.
Castling is only permissible if all the following conditions hold:
- The king and rook involved in castling must not have previously moved
- There must be no pieces between the king and the rook
- The king may not currently be under attack, nor may the king pass through or
end up in a square that is under attack by an enemy piece (though the rook is permitted
to be under attack and to pass over an attacked square)
- The castling must be [kingside] (blue) or [queenside] (red).

[kingside]: https://computerchessonline.net/castling/
[queenside]: https://computerchessonline.net/castling/