Answers.Body: <p>This is a very good question indeed but it took me a long time to understand what you wanted.</p>
  
  <p>So you are programming an interface and you wonder how the computer can tell if a player wants to play <code>Kg1</code> or <code>0-0</code> taking short castle as an example. The answer is that if both moves are legal then none of them takes precedence and the player can play whichever they desire. You then need a device how the player can make their intention clear to the computer. For instance dragging their king outside the board could do the castling. </p>
  
  <p>As BlindKungFuMaster explains in standard chess you do not have to worry about it since the King has to be on <code>e1</code> for a castle to be a legal move. Then there is no other legal move that could take the King on <code>g1</code> thus there is no ambiguity. </p>
  
  <p>In <em>Fisher Chess (chess 960)</em> however you can have an initial position with the King on <code>f1</code> and a Rook on <code>h1</code>. In this case both <code>Kf1-g1</code> and <code>0-0</code> would be legal moves. Even for over the board play the <a href="http://www.fide.com/component/handbook/?id=171&amp;view=article0" rel="noreferrer">Laws</a> (Appendix F) recommend a special procedure for castling to avoid misunderstanding.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-01-17T14:38:56.653Z
Answers.LastActivityDate: 2016-01-17T14:38:56.653Z
Answers.UserDisplayName: IA Petr Harasimovic
Answers.Body: <p>I know this is a late answer to a question that got bumped, but there are a couple of  essential points to add to @BlindKungFuMaster's answer:</p>
  
  <ol>
  <li>There can be no pieces on the squares in between the king and the castling rook (So knight/bishop on the kingside, and knight/bishop/queen on the queenside).</li>
  <li>It must be the first move for both pieces involved - So if you want to castle to the kingside, and either the rook on H1 or the king has moved off of their square and then back, you cannot castle to that side. If the king has not moved, but the rook on H1 has, and the rook on A1 has not, then you can still castle queenside.*</li>
  </ol>
  
  <p>*- Note: Square reference assumes castling as White.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-09-17T17:03:45.027Z
Answers.LastActivityDate: 2019-09-17T17:03:45.027Z
Answers.UserDisplayName: JohnP
Answers.Body: <p>Yes, but one additional point: If you have started to place the king on g1, for example, but you change your mind AND you have not taken your hand off it, you can still move it one square to another square as long as you have not also touched the rook. </p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-09-12T15:09:58.640Z
Answers.Text: Answer not directly relevant for someone referring to online play, as in this question.
Answers.UserDisplayName: Grade 'Eh' Bacon
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-09-12T15:15:54.993Z
Answers.Text: WHERE does he mention online play in the original question because I still do not see it? Besides, on the online sites that I have played on, as soon as you move the king two squares, it completes the rook move automatically.
Answers.UserDisplayName: PhishMaster
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-09-12T15:16:39.837Z
Answers.Text: I am assuming that you just downvoted me for your mistake too? Nice.
Answers.UserDisplayName: PhishMaster
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-09-12T02:45:28.010Z
Answers.LastActivityDate: 2019-09-12T02:45:28.010Z
Answers.UserDisplayName: PhishMaster
Answers.Body: <p>Yes, moving both the king and the rook are necessary to castle.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-08-27T17:58:06.100Z
Answers.LastActivityDate: 2019-08-27T17:58:06.100Z
Answers.UserDisplayName: Inertial Ignorance
Answers.Body: <p>Yes. </p>
  
  <p>Otherwise this would be an illegal move because during castling the king moves two squares, but apart from castling it is only allowed to move one square.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-01-16T11:15:00.107Z
Answers.Text: Ah silly me, the king moves TWO tiles in castling! I feel stupid now! (I've never done castling, just read some articles about it - as I need to program a chess client).
Answers.UserDisplayName: user38725
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-01-16T11:09:20.753Z
Answers.LastActivityDate: 2016-01-16T11:09:20.753Z
Answers.UserDisplayName: BlindKungFuMaster
Body: <p>I've got a simple question, that I'm having difficulty finding an answer for...</p>
  
  <p>If it is possible to castle (I know the conditions for it), and I decide to move the king to the square where it would end up in castling, do I have to "take the castling", i.e. move the rook too?</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-01-16T15:43:18.363Z
Comments.Text: It is called *squares* in chess not tiles. Also if you need to know how pieces move then you should read the [Laws of Chess](http://www.fide.com/component/handbook/?id=171&view=article), articles 1-3. Relying on unofficial sources like wikipedia and random articles on the web will likely result in a coding error.
Comments.UserDisplayName: IA Petr Harasimovic
Tags: <rules><castling>
Title: Castling, is it necessary to take it?
ThreadText: # Castling, is it necessary to take it?
  
  (Asked by: username_0 on 2016-01-16)
  
  I've got a simple question, that I'm having difficulty finding an answer for...
  
  If it is possible to castle (I know the conditions for it), and I decide to move the king to the square where it would end up in castling, do I have to "take the castling", i.e. move the rook too?
  
  **Tags:** rules, castling
  
  > **Comments:**
  > **username_1**: It is called *squares* in chess not tiles. Also if you need to know how pieces move then you should read the [Laws of Chess](http://www.fide.com/component/handbook/?id=171&view=article), articles 1-3. Relying on unofficial sources like wikipedia and random articles on the web will likely result in a coding error.  
  
  ---
  
  ## 5 answers
  
  ### Answer by username_6 on 2016-01-16. Score: 12 | Accepted answer
  
  Yes.
  
  Otherwise this would be an illegal move because during castling the king moves two squares, but apart from castling it is only allowed to move one square.
  
  > **Comments:**
  > **username_0**: Ah silly me, the king moves TWO tiles in castling! I feel stupid now! (I've never done castling, just read some articles about it - as I need to program a chess client).  
  
  ---
  
  ### Answer by username_1 on 2016-01-17. Score: 5
  
  This is a very good question indeed but it took me a long time to understand what you wanted.
  
  So you are programming an interface and you wonder how the computer can tell if a player wants to play `Kg1` or `0-0` taking short castle as an example. The answer is that if both moves are legal then none of them takes precedence and the player can play whichever they desire. You then need a device how the player can make their intention clear to the computer. For instance dragging their king outside the board could do the castling.
  
  As username_6 explains in standard chess you do not have to worry about it since the King has to be on `e1` for a castle to be a legal move. Then there is no other legal move that could take the King on `g1` thus there is no ambiguity.
  
  In *Fisher Chess (chess 960)* however you can have an initial position with the King on `f1` and a Rook on `h1`. In this case both `Kf1-g1` and `0-0` would be legal moves. Even for over the board play the [Laws](http://www.fide.com/component/handbook/?id=171&view=article0) (Appendix F) recommend a special procedure for castling to avoid misunderstanding.
  
  
  ---
  
  ### Answer by username_2 on 2019-09-17. Score: 1
  
  I know this is a late answer to a question that got bumped, but there are a couple of essential points to add to @username_6's answer:
  
  1. There can be no pieces on the squares in between the king and the castling rook (So knight/bishop on the kingside, and knight/bishop/queen on the queenside).
  2. It must be the first move for both pieces involved - So if you want to castle to the kingside, and either the rook on H1 or the king has moved off of their square and then back, you cannot castle to that side. If the king has not moved, but the rook on H1 has, and the rook on A1 has not, then you can still castle queenside.\*
  
  \*- Note: Square reference assumes castling as White.
  
  
  ---
  
  ### Answer by username_3 on 2019-09-12. Score: 1
  
  Yes, but one additional point: If you have started to place the king on g1, for example, but you change your mind AND you have not taken your hand off it, you can still move it one square to another square as long as you have not also touched the rook.
  
  > **Comments:**
  > **username_4**: Answer not directly relevant for someone referring to online play, as in this question.  
  > **username_3**: WHERE does he mention online play in the original question because I still do not see it? Besides, on the online sites that I have played on, as soon as you move the king two squares, it completes the rook move automatically.  
  > **username_3**: I am assuming that you just downvoted me for your mistake too? Nice.  
  
  ---
  
  ### Answer by username_5 on 2019-08-27. Score: 1
  
  Yes, moving both the king and the rook are necessary to castle.
  
  
  ---
  
  