logoalt Hacker News

nurettinlast Saturday at 5:07 AM1 replyview on HN

Why not just one bit "castled"?


Replies

toast0last Saturday at 5:52 AM

You can only castle if neither the king nor the rook have been moved (and none of the three squares the king uses may be under attack, and all the squares between the rook and the king must be empty).

Since you could move either rook somewhere and then back to their starting squares, you have to track their eligibility separately. If the king moves, both rooks lose eligibility.