Queenside castling allowed
- Input
- 4k3/8/8/8/8/8/8/R3K3 w Q
- Expected output
- O-O-O: Rei em c1, torre em d1
With the rook on a1 and b1, c1 and d1 empty, queenside castling works.
How to Play Chess: Interactive Lessons
castling rules in chess
Castling is the only move in which two pieces move together, the king and a rook. It protects the king and brings the rook into play, but it only works when every condition is met. The lesson below trains both castles and a case where it is forbidden.
With the rook on a1 and b1, c1 and d1 empty, queenside castling works.
The black rook on f2 attacks f1, the square the king would pass through. Castling is illegal, even though neither the king nor the rook has moved.
The black rook attacks b1, but the king only crosses d1 and c1. Square b1 only needs to be empty.
Start with the board and how each piece moves, then learn the rules that decide the game: check, checkmate and stalemate. Only then come the special moves (castling, en passant and promotion) and opening principles. This path follows exactly that order, with exercises after each explanation.
No. Castling is forbidden while the king is in check. To get out of check you must move the king, capture the attacker or block.
Short castling is on the kingside, with the nearer rook, written O-O. Long castling is on the queenside, with the farther rook, written O-O-O. In long castling the king ends up farther from the corner and more squares need to be empty.
Yes. Although it moves two pieces, castling is a single move by the player and uses up their turn.
Your rank: Pawn
0 of 21 lessons completed · 0 of 92 exercises
Lesson 15
The only move where two pieces move together: king and rook.
Castling is a special move that moves the king and a rook at the same time: the king goes two squares toward the rook and the rook jumps to the other side of the king, landing next to it. It protects the king and brings the rook into play.
There is kingside castling (with the closer rook, written O-O) and queenside castling (written O-O-O). To castle: 1) neither the king nor that rook may have moved before; 2) there can be no pieces between them; 3) the king cannot be in check, nor pass through or land on an attacked square.
Castle kingside with White.
You are playing White.
Use the arrow keys to move between squares. Enter or space selects a piece, then the destination square. Escape cancels.