Input (grade 13): A player who performs a forbidden castling must return the king and the rook to their original places and then move the king, if there is another legal king move, including castling on the other side.
Output (grade 8): In castling, the king is moved two squares toward the rook, and the rook moves past the king to the square right next to where the king has moved. Castling takes one move, and is the only way for a player to move two of his own pieces on the same move.