I'm writing a PGN file parser, and need to know in which situations you don't need to write the rank/file of a piece that makes the move. I can think of the following:
only one piece can conduct the move according to the rules of movement (i.e. attempting to move a bishop horizontally - that's obvious).
both pieces can move to the given square, but all but one are obstructed by other pieces
all but one of the pieces are pinned and moving them would expose the king to check
Anything else I'm missing?
I'd also like to add some seemingly ambiguous situations:
Black to move. Is Nc5+ valid PGN, or would it be Nbc5+? Is Nc5 valid, or would it be Nec5?
Black to move. Is Rg7# / Rg7+ valid PGN, or do I need to specify the rank here?
What if two pieces can move to the same square, but one of the moves would result in threefold repetition, and the game doesn't stop instantly?
What if two pieces can move to the same square, one of those moves forces a mate-in-one on the moving side, and the move is labeled "!!"? :)