(If Rook and King have not moved (and no funny business with pawns promoted to Rook), and none of the three spaces the King is involved with are attacked, and all the spaces between the King and the Rook are unoccupied) King moves two spaces, Rook moves to the space the king passed over. The order is important, at least in tournament play.
Thanks for pointing that out. I will definitely have to reword a few things on our site. Maybe the same 'essential' mechanic, or something to that effect.
The king could still move the same two squares in the direction of the rook, but it might mean that the space is sometimes occupied by the rook or you may be simply jumping over the rook.
Small nitpick: you could replace “no funny business with pawns promoted to Rook” with “and are on their home squares” as there’s no way for a promoted pawn to get to a rook’s home square without moving ;)
Well... if you want to get into really funny business, white could promote to a black Rook on its home square (not valid with current FIDE rules, but older rule sets weren't always specific about the color of the piece promoted to). I don't think you should castle with that Rook, but maybe?
I guess something about being on the squares since the beginning of the game.
The mechanic for standard chess is:
(If Rook and King have not moved (and no funny business with pawns promoted to Rook), and none of the three spaces the King is involved with are attacked, and all the spaces between the King and the Rook are unoccupied) King moves two spaces, Rook moves to the space the king passed over. The order is important, at least in tournament play.