PGN standard for comments

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

adams161
Posts: 626
Joined: Sun May 13, 2007 9:55 pm
Location: Bay Area, CA USA
Full name: Mike Adams

PGN standard for comments

Post by adams161 »

Hi, a user sent me this game:
[Event "?"]
[Site "?"]
[Date "2019.04.09"]
[Round "?"]
[White "Player"]
[Black "Player"]
[Result "*"]

1. d4 Nf6 2. c4 d5 3. Nf3 dxc4 (3... e6 4. Nc3 Be7 5. Bg5) 4. g3 c5 5. dxc5 *
Now openingtree cant read that as the comments are ( ) not { }. But i noticed Fritz 13 can. What is done here? Am i correct this is not supported or is it some expected short hand?
kranium
Posts: 2129
Joined: Thu May 29, 2008 10:43 am

Re: PGN standard for comments

Post by kranium »

adams161 wrote: Sat Apr 13, 2019 12:20 am Hi, a user sent me this game:
[Event "?"]
[Site "?"]
[Date "2019.04.09"]
[Round "?"]
[White "Player"]
[Black "Player"]
[Result "*"]

1. d4 Nf6 2. c4 d5 3. Nf3 dxc4 (3... e6 4. Nc3 Be7 5. Bg5) 4. g3 c5 5. dxc5 *
Now openingtree cant read that as the comments are ( ) not { }. But i noticed Fritz 13 can. What is done here? Am i correct this is not supported or is it some expected short hand?
Hi Mike,

as far as I am aware,
comments are {}
variations are ()

http://www.saremba.de/chessgml/standard ... htm#c8.2.5
adams161
Posts: 626
Joined: Sun May 13, 2007 9:55 pm
Location: Bay Area, CA USA
Full name: Mike Adams

Re: PGN standard for comments

Post by adams161 »

i updated openingtree to skip stuff between ( ). we dont have variation support but now they wont break us. I had not realized that the variations were not just part of comments as i often saw them there.
User avatar
hgm
Posts: 27790
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: PGN standard for comments

Post by hgm »

Some GUIs put variations (notably annotation with PVs from an engine analysis) in the PGN as plain {} comments. This is allowed, of course, but I have always argued it is a mistake. Because it makes it impossible for GUIs that do support the PGN standard for recursive variation to show them, and allow you to play through them.

Note that, unlike plain comments, variations can be nested, and the parentheses will have to be balanced. Comments will end at the first }, no matter how many {{{ there were before them. This is not entirely trivial, as unbalanced parentheses might occur in comments. E.g. after

( .... ( ... { good move : - ) }

you are stil two ) short for being back in the main line, not one!
adams161
Posts: 626
Joined: Sun May 13, 2007 9:55 pm
Location: Bay Area, CA USA
Full name: Mike Adams

Re: PGN standard for comments

Post by adams161 »

looks like i'm missing that variants can be nested. i suppose now a nested file would break. Well will get to it. comments wont be a problem wtih my code as we end them on first }.