pgn.net icon indicating copy to clipboard operation
pgn.net copied to clipboard

Error in pgn with "old notation"

Open osotorrio opened this issue 7 years ago • 7 comments

Hi,

First of all, thank you very much for your work. Great job!!

I have a PGN file from and when I try to read it with pgn.net it throws an exception:

Error in pgn: Ln: 318 Col: 34 35.Kc3 f3 36.b6 e4 37.b7 e3 38.b8Q Rxb8 39.Bxb8 Rxh2 40.Bxh2 1-0

Expecting: Comment ( {...} or ;... ), Game termination marker (1/2-1/2 or 1-0 or 0-1 or *), Move (e.g. Qc4 or e2e4 or 0-0-0 etc.), Move annotation (e.g. ! or ??), Move number indicator (e.g. 5. or 13...), NAG ($ e.g. $6 or $32), RAV e.g. "(6. Bd3)", Tag (e.g [Date "2013.10.02"]), end of input, '#', '+', '++', 'ch', 'dbl ch', '†', '††' or '‡'

As you can see the notation of the white move 38. b8Q is a bit weird. I guess it should be 38. b8=Q

Is the notation b8Q some kind of "old style"?. If so, why to throw an exception?...maybe it could support backward compatibility.

Thanks again!!

osotorrio avatar Sep 26 '16 16:09 osotorrio

As far as I know the PGN specs have always required the '=' symbol to denote a promotion; "b8Q" is sometimes seen in books and publications (the classic Chess Informat volumes, for example, have typically used a very shortened algebraic notation), but strictly speaking i don't think it was ever accepted in PGN standard, even if many common softwares gloss over it

Antaniserse avatar Sep 26 '16 17:09 Antaniserse

Hi Oscar, hi Luca.

I think the parser should be as forgiving as possible. If there are databases that denote the promotion in the abbreviated form, then there should be no error as long as it does not introduce any ambiguities.

I'll look into that. Thanks for reporting!

iigorr avatar Sep 28 '16 12:09 iigorr

Oscar, do you have a link to source where such moves are listed?

iigorr avatar Oct 13 '16 21:10 iigorr

Never mind. I found it in the FIDE rules:

C.12 In the case of the promotion of a pawn, the actual pawn move is indicated, followed immediately by the first letter of the new piece. Examples: d8Q, f8N, b1B, g1R.

https://www.fide.com/component/handbook/?id=124&view=article

So this is official and needs to be fixed.

iigorr avatar Oct 13 '16 22:10 iigorr

Unfortunatelly there is an ambiguity. It conflicts with the SAN annotation "Theoretical Novelty", which is TN or N. Now in case of N we get the conflict: f8N: pawn to f8 (Annotation: "Theoretical Novelty") f8N: pawn to f8, promoting to Knight

Of course the latter is much more probable, but the formal grammar would still be ambiguous...

iigorr avatar Oct 13 '16 22:10 iigorr

@iigorr I apologize for taking too long to answer. I did not receive any notification :(

I believe that any game downloaded from the official FIDE's website would have that notation. For instance: https://ratings.fide.com/view_games.phtml?id=1503014&name=%22Carlsen__Magnus(NOR)%22

osotorrio avatar Oct 29 '16 19:10 osotorrio

@osotorrio, thanks for your feedback. Ok. I will drop the SAN for "Theoretical Notation". FIDE games should be supported of course. :)

iigorr avatar Oct 30 '16 20:10 iigorr