Hacker News new | ask | show | jobs
by Sesse__ 764 days ago
One of the rooks might move over to the other side during the course of the game, and then it's no longer unambiguous which one is the castling rook.

E.g., if you have your king on e1, a rook on f1 and another one on g1… can you castle if the f1 rook moves? Can you castle if the g1 rook moves? Just “kingside” won't tell you the difference.

3 comments

Ah, that's the possibility I wasn't thinking of. Thank you.
the king always has to be in between rooks in chess960
As a starting position, sure.

But if you have a later board state, with two rooks on one side: how do you know which one is still eligible to castle?

I mean technically it still isn’t ambiguous because you could just refer to the starting position to see which rook is allowed to move.

Which of course is annoying to implement, but you do already have to keep state on the history of the game to determine if moves are legal, e.g. you can’t castle twice.

The entire point of a FEN is that it describes the entire board state without having to know anything about the history.

> Which of course is annoying to implement, but you do already have to keep state on the history of the game to determine if moves are legal, e.g. you can’t castle twice.

No, that's what the castling rights field in the FEN is for. Once you castle, you zero out both the k and q bits.

You don't have the starting position