Answers.Body: <p>We need to use the <em>first</em> step that that removes the ambiguity:</p>
  
  <ol>
  <li>Use the originating file letter (if the ambiguity was not removed, see #2).</li>
  <li>Use the originating rank number (if the ambiguity was not removed, see #3).</li>
  <li>Use both the file and rank from the originating square.</li>
  </ol>
  
  <hr>
  
  <p>1) <code>Rbb7</code> (because <strong>#1</strong>)<br>
  2) <code>Rab7</code> or <code>Rcb7</code> (both because <strong>#1</strong>)<br>
  3) <code>fxg5</code> (no disambiguation needed)<br>
  4) <code>hxg5</code> (no disambiguation needed)<br>
  5) <code>hxg6</code> (no disambiguation needed)<br>
  6) <code>Nac3</code> (because <strong>#1</strong>)<br>
  7) <code>Nbc3</code> or <code>Ndc3</code> (both because <strong>#1</strong>)  </p>
  
  <p>Now for the bonus example:</p>
  
  <p><img src="https://i.sstatic.net/y98HI.png" alt="enter image description here"></p>
  
  <p>in the case of <strong>g8</strong> queen to <em>g7</em>:<code>Qgg7</code> (because <strong>#1</strong>)<br>
  in the case of <strong>h7</strong> queen to <em>g7</em>:<code>Q7g7</code> (because <strong>#2</strong>)<br>
  in the case of <strong>h8</strong> queen to <em>g7</em>:<code>Qh8g7</code> (because <strong>#3</strong>)</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2013-01-10T22:55:23.490Z
Answers.LastActivityDate: 2013-01-11T22:13:59.967Z
Answers.LastEditDate: 2013-01-11T22:13:59.967Z
Answers.UserDisplayName: ajax333221
Answers.Body: <pre><code>
  
  [FEN "1R4QQ/R1R4Q/8/6pP/5P1P/8/NK1k4/1N1N4 w - g6 0 1"]
  
  </code></pre>
  
  <p>What would happen if:</p>
  
  <p><strong>1.</strong> the top rook moves to b7?</p>
  
  <p><code>Rbb7</code></p>
  
  <p><strong>2.</strong> one of the bottom rooks moves to b7?</p>
  
  <p><code>Rab7</code> or <code>Rcb7</code></p>
  
  <p><strong>3.</strong> the left pawn takes xg5?</p>
  
  <p><code>fxg5</code></p>
  
  <p><strong>4.</strong> the bottom right pawn takes xg5?</p>
  
  <p><code>hxg5</code></p>
  
  <p><strong>5.</strong> the top right pawn takes xg6 by en passant?</p>
  
  <p><code>hxg6!</code></p>
  
  <p><strong>6.</strong> the top left knight goes to c3?</p>
  
  <p><code>Nac3</code></p>
  
  <p><strong>7.</strong> one of the bottom knight goes to c3?</p>
  
  <p><code>Nbc3</code> or <code>Ndc3</code></p>
  
  <p><strong>bonus</strong> What would happen if any queen wants to go to g7?</p>
  
  <p>When all else fails, be explicit. <code>Qh8g7</code> or <code>h8g7</code></p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2013-01-11T05:58:48.700Z
Answers.LastActivityDate: 2019-09-21T17:13:13.587Z
Answers.LastEditDate: 2019-09-21T17:13:13.587Z
Answers.UserDisplayName: Travis J
Answers.Body: <p>From the <a href="http://web.archive.org/web/20100528142843/http://www.very-best.de/pgn-spec.htm#8.2.3" rel="noreferrer">specification</a>:</p>
  <blockquote>
  <p>A basic SAN [Standard Algebraic Notation] move is given by listing the moving piece letter (omitted for pawns) followed by the destination square. Capture moves are denoted by the lower case letter &quot;x&quot; immediately prior to the destination square; pawn captures the file letter of the originating square of the capturing pawn immediately prior to the &quot;x&quot; character.</p>
  </blockquote>
  <p>And</p>
  <blockquote>
  <p>In the case of ambiguities (multiple pieces of the same type moving to the same square), the first appropriate disambiguating step of the three following steps is taken:</p>
  <p>First, if the moving pieces can be distinguished by their originating files, the originating file letter of the moving piece is inserted immediately after the moving piece letter.</p>
  <p>Second (when the first step fails), if the moving pieces can be distinguished by their originating ranks, the originating rank digit of the moving piece is inserted immediately after the moving piece letter.</p>
  <p>Third (when both the first and the second steps fail), the two character square coordinate of the originating square of the moving piece is inserted immediately after the moving piece letter.</p>
  </blockquote>
  <p>1: <code>Rbb7</code></p>
  <p>2: <code>Rab7</code> or <code>Rcb7</code></p>
  <p>3: <code>fxg5</code></p>
  <p>4: <code>hxg5</code></p>
  <p>5: <code>hxg6</code></p>
  <p>6: <code>Nac3</code></p>
  <p>7: <code>Nbc3</code> or <code>Ndc3</code></p>
  <p>Note that this is simply how the specification is written. En passant captures should not be an edge case, but they are unlikely to be implemented correctly 100% of the time. You'll have to test your replayer to see whether it handles these cases correctly or not.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-02-23T20:51:31.160Z
Answers.Text: Warning: your implementation may vary. An online PGN tool I constantly use notates as Q8g7,Q7g7 and Qhg7. Works in this example, but being a natural born troll, I positioned 8 queens around g7. No crash, but now Qf8-g7 is impossible to notate: even if I write it out in PGN, and load it, Qf6-g7 is played. (Of course the probability of this happening in RL is about zero.)
Answers.UserDisplayName: Hauke Reddmann
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2013-01-10T20:25:42.413Z
Answers.LastActivityDate: 2013-01-11T00:34:36.387Z
Answers.LastEditDate: 2020-06-17T09:59:59.497Z
Answers.UserDisplayName: Jonathan Garber
Body: <p>How are ambiguities handled when writing the PGN when more than one piece of the same type can move into the same square?</p>
  
  <pre><code>[FEN "1R4QQ/R1R4Q/8/6pP/5P1P/8/NK1k4/1N1N4 w - g6 0 1"]
  </code></pre>
  
  <p><strong>Note:</strong> It isWhite to move, with an en passant capturing square on g6.</p>
  
  <p><strong>What would happen if</strong>:</p>
  
  <ol>
  <li>the top rook moves to <code>b7</code>?</li>
  <li>one of the bottom rooks moves to <code>b7</code>?</li>
  <li>the left pawn takes <code>xg5</code>?</li>
  <li>the bottom right pawn takes <code>xg5</code>?</li>
  <li>the top right pawn takes <code>xg6</code> by en passant_?</li>
  <li>the top left knight goes to <code>c3</code>?</li>
  <li>one of the bottom knight goes to <code>c3</code>?</li>
  </ol>
  
  <p><strong>Edit (bonus question):</strong></p>
  
  <ul>
  <li>What would happen if any queen wants to go to <code>g7</code>?</li>
  </ul>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2013-01-11T23:14:43.987Z
Comments.Text: BTW, the position can't legally be white to move, since black is in check.
Comments.UserDisplayName: ETD
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2013-01-17T05:23:54.140Z
Comments.Text: **you might also want to read:** [is there the need to disambiguate if the other pieces are pinned?](http://chess.stackexchange.com/questions/1864/is-this-case-considered-an-ambiguity-or-not)
Comments.UserDisplayName: ajax333221
Tags: <notation><pgn>
Title: How are PGN ambiguities handled?
ThreadText: # How are PGN ambiguities handled?
  
  (Asked by: username_0 on 2013-01-10)
  
  How are ambiguities handled when writing the PGN when more than one piece of the same type can move into the same square?
  [FEN "1R4QQ/R1R4Q/8/6pP/5P1P/8/NK1k4/1N1N4 w - g6 0 1"]
  
  Note: It isWhite to move, with an en passant capturing square on g6.
  What would happen if:
  
  the top rook moves to b7?
  one of the bottom rooks moves to b7?
  the left pawn takes xg5?
  the bottom right pawn takes xg5?
  the top right pawn takes xg6 by en passant_?
  the top left knight goes to c3?
  one of the bottom knight goes to c3?
  
  Edit (bonus question):
  
  What would happen if any queen wants to go to g7?
  
  **Tags:** notation, pgn
  
  > **Comments:**
  > **username_1**: BTW, the position can't legally be white to move, since black is in check.  
  > **username_0**: **you might also want to read:** [is there the need to disambiguate if the other pieces are pinned?](http://chess.stackexchange.com/questions/1864/is-this-case-considered-an-ambiguity-or-not)  
  
  ---
  
  ## 3 answers
  
  ### Answer by username_3 on 2013-01-10. Score: 12 | Accepted answer
  
  From the [specification](http://web.archive.org/web/20100528142843/http://www.very-best.de/pgn-spec.htm#8.2.3):
  
  > A basic SAN [Standard Algebraic Notation] move is given by listing the moving piece letter (omitted for pawns) followed by the destination square. Capture moves are denoted by the lower case letter "x" immediately prior to the destination square; pawn captures the file letter of the originating square of the capturing pawn immediately prior to the "x" character.
  
  And
  
  > In the case of ambiguities (multiple pieces of the same type moving to the same square), the first appropriate disambiguating step of the three following steps is taken:
  >
  > First, if the moving pieces can be distinguished by their originating files, the originating file letter of the moving piece is inserted immediately after the moving piece letter.
  >
  > Second (when the first step fails), if the moving pieces can be distinguished by their originating ranks, the originating rank digit of the moving piece is inserted immediately after the moving piece letter.
  >
  > Third (when both the first and the second steps fail), the two character square coordinate of the originating square of the moving piece is inserted immediately after the moving piece letter.
  
  1: `Rbb7`
  
  2: `Rab7` or `Rcb7`
  
  3: `fxg5`
  
  4: `hxg5`
  
  5: `hxg6`
  
  6: `Nac3`
  
  7: `Nbc3` or `Ndc3`
  
  Note that this is simply how the specification is written. En passant captures should not be an edge case, but they are unlikely to be implemented correctly 100% of the time. You'll have to test your replayer to see whether it handles these cases correctly or not.
  
  > **Comments:**
  > **username_4**: Warning: your implementation may vary. An online PGN tool I constantly use notates as Q8g7,Q7g7 and Qhg7. Works in this example, but being a natural born troll, I positioned 8 queens around g7. No crash, but now Qf8-g7 is impossible to notate: even if I write it out in PGN, and load it, Qf6-g7 is played. (Of course the probability of this happening in RL is about zero.)  
  
  ---
  
  ### Answer by username_0 on 2013-01-10. Score: 4
  
  We need to use the *first* step that that removes the ambiguity:
  
  1. Use the originating file letter (if the ambiguity was not removed, see #2).
  2. Use the originating rank number (if the ambiguity was not removed, see #3).
  3. Use both the file and rank from the originating square.
  
  ---
  
  1) `Rbb7` (because **#1**)  
  2) `Rab7` or `Rcb7` (both because **#1**)  
  3) `fxg5` (no disambiguation needed)  
  4) `hxg5` (no disambiguation needed)  
  5) `hxg6` (no disambiguation needed)  
  6) `Nac3` (because **#1**)  
  7) `Nbc3` or `Ndc3` (both because **#1**)
  
  Now for the bonus example:
  
  ![enter image description here](https://i.sstatic.net/y98HI.png)
  
  in the case of **g8** queen to *g7*:`Qgg7` (because **#1**)  
  in the case of **h7** queen to *g7*:`Q7g7` (because **#2**)  
  in the case of **h8** queen to *g7*:`Qh8g7` (because **#3**)
  
  
  ---
  
  ### Answer by username_2 on 2013-01-11. Score: 3
  
  [FEN "1R4QQ/R1R4Q/8/6pP/5P1P/8/NK1k4/1N1N4 w - g6 0 1"]
  
  
  What would happen if:
  1. the top rook moves to b7?
  Rbb7
  2. one of the bottom rooks moves to b7?
  Rab7 or Rcb7
  3. the left pawn takes xg5?
  fxg5
  4. the bottom right pawn takes xg5?
  hxg5
  5. the top right pawn takes xg6 by en passant?
  hxg6!
  6. the top left knight goes to c3?
  Nac3
  7. one of the bottom knight goes to c3?
  Nbc3 or Ndc3
  bonus What would happen if any queen wants to go to g7?
  When all else fails, be explicit. Qh8g7 or h8g7
  
  
  ---
  
  