PGN stands for Portable Game Notation. It’s one of the standards for storing chess games and their associated data in a plain text format. It was first specified in 1993 by Steven J. Edwards.
It’s designed to be (somewhat) easy for humans to write and read, while also being capable of being parsed, generated and analyzed by computers. PGN’s design aims are:
- to have its details publicly available and as simple as possible,
- to be non-propietary to remove restrictions based on copyright,
- to work for a variety of programs,
- to be expandable and scalable,
- to be international/free of local conventions, and
- to be about as complex and long as existing formats
Although the complete specs (HTML) deal with quite complex subjects (character encoding, edge cases, a suggested directory structure…) the core syntax is quite simple. A PGN file contains:
- One or more tags: bracket-enclosed pairs of data specifiyng details about the match itself: event, site, date, player names, etc.
- The “movetext”: essentially the game moves recorded in Standard Algebraic Notation or Figurine Algebraic Notation
- Comments: entered either with a semicolon and through to the end of the line, or by enclosing it in curly brackets
- Alternatives: enclosed in parenthesis
An edited sample: the 2018 Chess World Championship Game 1
[Event "Carlsen-Caruana FIDE World Chess Championship"]
[Date "2018.11.09"]
[White "Caruana, Fabiano"]
[Black "Carlsen, Magnus"]
[Result "1/2-1/2"]
[Annotator "https://lichess.org/@/broadcaster"]
1. e4 c5 2. Nf3 Nc6 3. Bb5 g6 4. Bxc6 dxc6 5. d3 Bg7 6. h3 Nf6
7. Nc3 Nd7?! { Inaccuracy. Best move was Qc7. } (7... Qc7 8. Be3 b6
9. a3 O-O 10. O-O Ba6 11. a4 e5 12. b3)
See also:
Bacon jam ← Andy’s Brevity Quest 2019 (295 words) → Tickets, money, speech