user478: 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?


user342: 

[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

user478: We need to use the first step that that removes the ambiguity:

Use the originating file letter (if the ambiguity was not removed, see #2).
Use the originating rank number (if the ambiguity was not removed, see #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:

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)

user652: From the specification:

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.

478: <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>
 342: <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>
 478: <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.stack.imgur.com/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>
 652: <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>
