5

Is the result of a game a (the) must at the end of every PGN? (I mean any of "1-0", "0-1", "1/2-1/2", and "*") So... we can have a whole set of tags, then a "1/2-1/2" result with no moves, and enjoy it as a valid PGN. A PGN with no moves.

[Event: whatever]

[White: me]

[Black: also me]

1/2-1/2

Since I can have a PGN with no tags as well, I'm wondering if the minimum requirement you need for a valid PGN game is only the result at the end. Is it?

In this case, the smallest PGN would be: *
"Nothing known about who played, where or why, and nobody made a move, and then we also don't know, but maybe they died if it is a very old game".

Which brings me to the other question, should my superhuman interdimensional parser nexus consider a PGN game without result a no-go invalid PGN (especially considering no tag with result was not provided either)?

And I would appreciate if someone could tell us if, when the result is in a tag, it is not necessary to display it after moves? (which would then be a valid case of 'no need to write result at end' scenario.)

2 Answers 2

3

Is the result of a game a (the) must at the end of every PGN? (I mean any of "1-0", "0-1", "1/2-1/2", and "*") So... we can have a whole set of tags, then a "1/2-1/2" result with no moves, and enjoy it as a valid PGN. A PGN with no moves.

Your use of the term 'PGN' is unclear. Do you mean a 'PGN game'? If so, do you refer to a PGN game in 'export format' or in 'import format'? I'm going to assume export format/archival format, but you are making other statements that suggest that you may possibly think of input format.

PGN requires each PGN-game (see appendix J) in export format to end with a game-termination sequence of characters (I deliberately avoid to use the word 'token' because of the way PGN defines that term).

Although PGN does not specify that empty games be followed only by "*", it seems likely that other implementers of PGN may interpret it that a specific result implies that a non-empty set of moves are expected to be present.

And note that PGN does not claim to follow FIDE: 'games' that never start are not necessarily considerd to have terminated, and games with illegal moves are not considered as 'interesting enough' to be represented as a PGN game.

Since I can have a PGN with no tags as well, I'm wondering if the minimum requirement you need for a valid PGN game is only the result at the end. Is it?

You can't omit the seven-tag roster from export or archive format PGN. You may omit them from import-format PGN, but there's no strict definition of that format, as it is intended for data created by hand.

For strict PGN archive format, you must include all seven mandatory tags in the specified order. (see 8.1.1)

Which brings me to the other question, should my superhuman interdimensional parser nexus consider a PGN game without result a no-go invalid PGN (especially considering no tag with result was not provided either)?

If you are implementing a PGN import format parser, you do what you like. If you are considering a PGN export/archive format reader, you must consider it an incorrectly formatted PGN game.

And I would appreciate if someone could tell us if, when the result is in a tag, it is not necessary to display it after moves? (which would then be a valid case of 'no need to write result at end' scenario.)

The content of the tag Result must be the same as the game-terminator actually used in the movetext section. It says so right there: (section 8.1.1.7). If it isn't the same, you have a PGN game that doesn't follow the specifications of a PGN export format.

PGN was (probably) created for parsing simplicity (my interpretation). It should (probably) be possible for a beginning programmer to write the code to read a PGN archive, and output a table of content without having to parse the entire move-text sections; just looking for the tag lines should be enough. So expect redundancies, and the need for cross-checks.

Added:

In this case, the smallest PGN would be: * "Nothing known about who played, where or why, and nobody made a move, and then we also don't know, but maybe they died if it is a very old game".

Please cross-check that with what PGN says about representing unknown information in export format games. (hint: see sections 8.1.1.1, 8.1.1.2, 8.1.1.3, 8.1.1.4, 8.1.1.5. and also 8.1.1.6, if only indirectly.)

1
  • Man... this is so great :) You actually pointed out some issues I forgot to take into account in my parser. It is that i'm trying to be as universal as possible - like in expecting no tags at all, etc. - while at the same time allocating rooms for details in a database i'm buiding. Many thanks. Apr 18 at 19:28
6

Is the result of a game a (the) must at the end of every PGN?

No.

The original specification is available here. It makes no mention of any information which is absolutely required for such a file to be valid.

From the introduction to the document:

The intent of the definition and propagation of PGN is to facilitate the sharing of public domain chess game data among chessplayers (both organic and otherwise), publishers, and computer chess researchers throughout the world.

PGN is not intended to be a general purpose standard that is suitable for every possible use; no such standard could fill all conceivable requirements. Instead, PGN is proposed as a universal portable representation for data interchange. The idea is to allow the construction of a family of chess applications that can quickly and easily process chess game data using PGN for import and export among themselves.

The document goes on to describe how different chess game related data can be exchanged using the standard. It does not define a minimally correct pgn file. It presents a solution to the problem of a universal standard for exchanging chess game data. It does not address what to do if you have no such data to exchange.

4
  • what about in practice? what is the minimum pgn you can load into programs?
    – brekker
    Apr 13 at 19:07
  • @brekker how about creating a new board on chessbase and exporting to pgn. it gives [Event "?"] [Site "?"] [Date "????.??.??"] [Round "?"] [White "?"] [Black "?"] [Result "*"] [PlyCount "0"] *
    – cmgchess
    Apr 13 at 19:21
  • interesting, i tried importing something similar (a couple fewer tags) to chess.com but it said invalid pgn
    – brekker
    Apr 13 at 19:36
  • Very good. Since ignoring it is out of question, we have tp look for either a 1) space 1 dot (marking start of new game), 2) the "[" char meaning the header of a new game 3) a new game that doesn't start on 1 (and has no FEN header... tricky) 4) end of file. I can't think of other alternatives to a game ending without a result. Many thanks, now we know :) Situation 3 would be hell if new game starts on move numbers previous game ended. Theoretically, it might even CONTINUE ok... Apr 13 at 20:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.