Portable Game Notation

1

Portable Game Notation (PGN) is a standard plain text format for recording chess games (both the moves and related data), which can be read by humans and is also supported by most chess software.

History

PGN was devised around 1993, by Steven J. Edwards, and was first popularized and specified via the Usenet newsgroup rec.games.chess.

Usage

PGN is structured "for easy reading and writing by human users and for easy parsing and generation by computer programs." The chess moves themselves are given in algebraic chess notation using English initials for the pieces. The filename extension is. There are two formats in the PGN specification, the "import" format and the "export" format. The import format describes data that may have been prepared by hand, and is intentionally lax; a program that can read PGN data should be able to handle the somewhat lax import format. The export format is rather strict and describes data prepared under program control, similar to a pretty printed source program reformatted by a compiler. The export format representations generated by different programs on the same computer should be exactly equivalent, byte for byte. PGN text begins with a set of "tag pairs" (a tag name and its value), followed by the "movetext" (chess moves with optional commentary).

Tag pairs

Tag pairs begin with an initial left bracket [, followed by the name of the tag in plain ASCII text. The tag value is enclosed in double-quotes, and the tag is then terminated with a closing right bracket ]. A quote inside a tag value is represented by the backslash immediately followed by a quote. A backslash inside a tag value is represented by two adjacent backslashes. There are no special control codes involving escape characters, or carriage returns, and linefeeds to separate the fields, and superfluous embedded spaces are usually skipped when parsing.

Seven Tag Roster

PGN data for archival storage is required to provide seven tag pairs – together known as the "Seven Tag Roster". In export format, these tag pairs must appear before any other tag pairs and in this order:

Optional tag pairs

The standard allows for other optional tag pairs. The more common ones include:

Movetext

The movetext describes the actual moves of the game. This includes move number indicators (numbers followed by either one or three periods; one if the next move is White's move, three if the next move is Black's move) and movetext in Standard Algebraic Notation (SAN). For most moves the SAN consists of the letter abbreviation for the piece, an if there is a capture, and the two-character algebraic name of the final square the piece moved to. The letter abbreviations are (king), (queen), (rook), (bishop), and (knight). The pawn is given an empty abbreviation in SAN movetext, but in other contexts the abbreviation is used. The algebraic name of any square is as per usual algebraic chess notation; from white's perspective, the leftmost square closest to white is, the rightmost square closest to the white is , and the rightmost (from white's perspective) square closest to black side is. In a few cases, a more detailed representation is needed to resolve ambiguity; if so, the piece's file letter, numerical rank, or the exact square is inserted after the moving piece's name (in that order of preference). Thus, specifies that the knight originally on the g-file moves to e2. SAN kingside castling is indicated by the sequence ; queenside castling is indicated by the sequence (note that these are capital Os, not zeroes, contrary to the FIDE standard for notation). Pawn promotions are notated by appending to the destination square, followed by the piece the pawn is promoted to. For example:. If the move is a checking move, is also appended; if the move is a checkmating move, is appended instead. For example:. An annotator who wishes to suggest alternative moves to those actually played in the game may insert variations enclosed in parentheses. They may also comment on the game by inserting Numeric Annotation Glyphs (NAGs) into the movetext. Each NAG reflects a subjective impression of the move preceding the NAG or of the resultant position. If the game result is anything other than, the result is repeated at the end of the movetext.

Comments

Comments are inserted by either a (a comment that continues to the end of the line) or a (which continues until a ). Comments do not nest.

Example

Here is the PGN format of the 29th game of the 1992 match played in Yugoslavia between Bobby Fischer and Boris Spassky:

Handling chess variants

Many chess variants can be recorded using PGN, provided the names of the pieces can be limited to one character, usually a letter and not a number. They are typically noted with a tag named "Variant" giving the name of the rules. The term "Variation" must be avoided, as that refers to the name of an opening variation. Note that traditional chess programs can only handle, at most, a few variants. Forsyth-Edwards Notation is used to record the starting position for variants (such as Chess960) which have initial positions other than the orthodox chess initial position.

Blind Game Notation

A proposed variant of pgn is Blind Game Notation, or BGN, for Blind Players. FIDE Master Kevin Bachler developed this variant in 2022 in conjunction with several members of the US Blind Chess Association, notably Marilyn Bland and Eric (Ché) Martin. The key differences are

  1. Translation for Output: For any existing database system, specialized chess symbols other than the basic are translated to text, because the more complex symbols are not available within a simple ASCII character set. The basic symbols are: a. !!
  • Excellent move b. !
  • Good move c. !?
  • Double-edged move d. ?!
  • Dubious move e. ?
  • Bad move f. ??
  • Blunder g. + - Check h. # - Checkmate For example, the chess symbol ∆ means “with the idea of.” Because this symbol is not generally available, it should always be converted to text when saved to BGN or printed from BGN.
  1. Line Breaks and Game Moves: Text or screen readers used by blind players often have issues with verbalizing "run-on" text understandable. Thus, the following rules are important to make reading to the blind player more understandable. a. Paired game moves appear on separate lines. (Scoresheet fashion.) Example: Do not use 1. e4 e5 2. Nf3 Nc6 but instead
  2. e4 e5 2. Nf3 Nc6 b. A blank line must appear after a move and before a comment. c. Comments begin on a new line, with the mentioned blank line above it and below the move to which the comment applies. d. A Comment's beginning is denoted by a single vertical bar sign plus a space before the comment begins e. The end of a Comment is on a separate line after the end of the comment text. This line has 2 vertical bars plus a space. Example of the above comments: Example:
  3. e4 e5 2. Nf3 Nc6
  4. Bb5 | White opens with the Ruy Lopez Opening. || 3... a6 f. Vertical bars are important because text or screen readers often only announce whatever sort of bracket PGN software provides only by the user exploring with the cursor, which is tedious for the blind player. With this revised format, one can use the arrow down key to find when a vertical bar is announced, indicating a comment has begun. Double vertical bars indicating the closure of the comment are on a separate line, so anyone wishing to skip the comment can arrow down the line by line until they are announced.
  5. Comments must never begin with a move, as this is too easily mistaken for normal notation. When a move is to start a comment, start like this: | Comment:
  6. Start each sentence of a comment on a separate line.
  7. For variations: Start it on a new line with a letter: Example: For nested variations, add numbers. Extended text sounds like spaghetti to the blind player. Example 8 Bf4 00 8 h3 Nd7

This article is derived from Wikipedia and licensed under CC BY-SA 4.0. View the original article.

Wikipedia® is a registered trademark of the Wikimedia Foundation, Inc.
Bliptext is not affiliated with or endorsed by Wikipedia or the Wikimedia Foundation.

Edit article