Page 1 of 1

PGN Standards conflict?

PostPosted: 27 Nov 2007, 16:56
by Norm Pollock
I found an example where PGN Standards conflict with each other.

http://www.geocities.com/CapeCanaveral/ ... n_spec.htm

In "FEN" games where the first move is by Black, or after annotations preceding the next move which is by Black, there appear to be TWO different ways to indicate the next move.

The first method is three dots appended to the move number. This appears as a written instruction in Section 8.2.2.2:

Code: Select all

8.2.2.2: Export format move number indications
There are two export format move number indication formats, one for use appearing immediately before a white move element and one for use appearing immediately before a black move element. A white move number indication is formed from the integer giving the fullmove number with a single period character appended. A black move number indication is formed from the integer giving the fullmove number with three period characters appended.

All white move elements have a preceding move number indication. A black move element has a preceding move number indication only in two cases: first, if there is intervening annotation or commentary between the black move and the previous white move; and second, if there is no previous white move in the special case where a game starts from a position where Black is the active player.

There are no other cases where move number indications appear in PGN export format.



The second method is the 3 dots appearing as a "move", found as an example in Section 16.1.4 of the PGN standards:
Code: Select all

16.1.4: Examples
Here's the FEN for the starting position:

rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1

And after the move 1. e4:

rnbqkbnr/pppppppp/8/8/4P3/8/PPPP1PPP/RNBQKBNR b KQkq e3 0 1

And then after 1. ... c5:

rnbqkbnr/pp1ppppp/8/2p5/4P3/8/PPPP1PPP/RNBQKBNR w KQkq c6 0 2

And then after 2. Nf3:

rnbqkbnr/pp1ppppp/8/2p5/4P3/5N2/PPPP1PPP/RNBQKB1R b KQkq - 1 2

For two kings on their home squares and a white pawn on e2 (White to move) with thirty eight full moves played with five halfmoves since the last pawn move or capture:

4k3/8/8/8/8/8/4P3/4K3 w - - 5 39



So which is right? Are they both right?

Re: PGN Standards conflict?

PostPosted: 27 Nov 2007, 19:47
by Harald Lüßen
Norm Pollock wrote:I found an example where PGN Standards conflict with each other.

http://www.geocities.com/CapeCanaveral/ ... n_spec.htm

In "FEN" games where the first move is by Black, or after annotations preceding the next move which is by Black, there appear to be TWO different ways to indicate the next move.

The first method is three dots appended to the move number. This appears as a written instruction in Section 8.2.2.2:

Code: Select all

8.2.2.2: Export format move number indications
There are two export format move number indication formats, one for use appearing immediately before a white move element and one for use appearing immediately before a black move element. A white move number indication is formed from the integer giving the fullmove number with a single period character appended. A black move number indication is formed from the integer giving the fullmove number with three period characters appended.

All white move elements have a preceding move number indication. A black move element has a preceding move number indication only in two cases: first, if there is intervening annotation or commentary between the black move and the previous white move; and second, if there is no previous white move in the special case where a game starts from a position where Black is the active player.

There are no other cases where move number indications appear in PGN export format.



The second method is the 3 dots appearing as a "move", found as an example in Section 16.1.4 of the PGN standards:
Code: Select all

16.1.4: Examples
Here's the FEN for the starting position:

rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1

And after the move 1. e4:

rnbqkbnr/pppppppp/8/8/4P3/8/PPPP1PPP/RNBQKBNR b KQkq e3 0 1

And then after 1. ... c5:

rnbqkbnr/pp1ppppp/8/2p5/4P3/8/PPPP1PPP/RNBQKBNR w KQkq c6 0 2

And then after 2. Nf3:

rnbqkbnr/pp1ppppp/8/2p5/4P3/5N2/PPPP1PPP/RNBQKB1R b KQkq - 1 2

For two kings on their home squares and a white pawn on e2 (White to move) with thirty eight full moves played with five halfmoves since the last pawn move or capture:

4k3/8/8/8/8/8/4P3/4K3 w - - 5 39



So which is right? Are they both right?

I would say 8.2.2.2 is right. (1... e5) and 16.1.4 is wrong.
But strictly speaking 16.1.4 is just text and not PGN and therefore it
is ok to use this syntax. Reading a PGN I would accept a lot of dots:
Code: Select all
    if num_dots > 5 or num_spaces > 3:
        raise PGNException, ('Too many move number dots or spaces', lineno, spos)
    if num_dots > 1 and current_board.color != black:
        raise PGNException, ('Move number dots with white to move', lineno, spos)
    if move_dots.strip() not in ('.', '..', '...', '....', '.....', '. ..', '. ...', '. ....'):
        raise PGNException, ('Bad sequence of move number dots', lineno, spos)

That was from my Python PGN reader.

Harald