Hello guys,
Do you know if there is some software or code available to validate PGNs?
I have a code that creates all the moves in a position, I validated on many PGNs but that doesn't prove my code doesn't generate impossible moves. (because I encode and decode, so both could contain the same error)
I would like to generate thousands of random games and validate them
Thanks
PGN validator
Moderators: hgm, Rebel, chrisw
-
- Posts: 2559
- Joined: Fri Nov 26, 2010 2:00 pm
- Location: Czech Republic
- Full name: Martin Sedlak
Re: PGN validator
Interesting question.
I've downloaded some pgns recently and found that they contain underspecified (=ambiguous) SAN moves.
My SAN parser rejects such moves but I found that some GUIs are still able to read such PGNs, I wonder if they
1) branch on ambiguous moves, trying all possibilities
2) pick a move at random (say keep the first one that comes out of move generator)
I couldn't find anything related to this in the specs, so I wonder if such PGNs are simply broken or if there's some standard way to resolve
ambiguous SAN moves
So an additional question would be is there a tool that can actually repair such PGN files so that the moves are encoded properly without ambiguities?
I've downloaded some pgns recently and found that they contain underspecified (=ambiguous) SAN moves.
My SAN parser rejects such moves but I found that some GUIs are still able to read such PGNs, I wonder if they
1) branch on ambiguous moves, trying all possibilities
2) pick a move at random (say keep the first one that comes out of move generator)
I couldn't find anything related to this in the specs, so I wonder if such PGNs are simply broken or if there's some standard way to resolve
ambiguous SAN moves
So an additional question would be is there a tool that can actually repair such PGN files so that the moves are encoded properly without ambiguities?
Martin Sedlak
-
- Posts: 1056
- Joined: Fri Mar 10, 2006 6:07 am
- Location: Basque Country (Spain)
Re: PGN validator
The joined_ tool allows to verify the games of a pgn file, for example I found that when passing games from a chessbase database to a pgn there are ambiguities with SAN. It warns but does not correct.
joined -q -v126 file.pgn
The pgn-extract tool allows you to correct some ambiguities and clean up some things. For example I use:
pgn-extract -s -N -C -V --fixresulttags --nobadresults -o outfile.pgn infile.pgn
Scid has an online tool that allows you to take games from a pgn file and convert them into an scid database (pgnscid.exe ?), in the process it checks the legality of all moves. I have a script (echiquierBriochin.fr) that allows to download games from twic in pgn and to pass to scid and that if there is a non legal move it indicates in a text editor the line where the problem is to be corrected.
joined -q -v126 file.pgn
The pgn-extract tool allows you to correct some ambiguities and clean up some things. For example I use:
pgn-extract -s -N -C -V --fixresulttags --nobadresults -o outfile.pgn infile.pgn
Scid has an online tool that allows you to take games from a pgn file and convert them into an scid database (pgnscid.exe ?), in the process it checks the legality of all moves. I have a script (echiquierBriochin.fr) that allows to download games from twic in pgn and to pass to scid and that if there is a non legal move it indicates in a text editor the line where the problem is to be corrected.