Portable Game Notation

Last updated
Filename extension
.pgn
Internet media type
application/vnd.chess-pgn
Developed by Steven J. Edwards
Initial release1993;30 years ago (1993)
Type of format Chess game record

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.

Contents

History

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

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 .pgn.

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:

EventName of the tournament or match event.
SiteLocation of the event. This is in City, Region COUNTRY format, where COUNTRY is the three-letter International Olympic Committee code for the country. An example is New York City, NY USA.
Although not part of the specification, some online chess platforms will include a URL or website as the site value. [3]
DateStarting date of the game, in YYYY.MM.DD form. ?? is used for unknown values.
RoundPlaying round ordinal of the game within the event.
WhitePlayer of the white pieces, in Lastname, Firstname format.
BlackPlayer of the black pieces, same format as White.
ResultResult of the game. It is recorded as White score, dash, then Black score, or * (other, e.g., the game is ongoing).

Optional tag pairs

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

Annotator The person providing notes to the game.
PlyCount String value denoting the total number of half-moves played.
TimeControl e.g. 40/7200:3600 (moves per seconds: sudden death seconds)
Time Time the game started, in HH:MM:SS format, in local clock time.
Termination Gives more details about the termination of the game. It may be abandoned, adjudication (result determined by third-party adjudication), death, emergency, normal, rules infraction, time forfeit, or unterminated.
ModeOTB (over-the-board) ICS (Internet Chess Server)
FEN The initial position of the chessboard, in Forsyth–Edwards Notation. This is used to record partial games (starting at some initial position). It is also necessary for chess variants such as Chess960, where the initial position is not always the same as traditional chess.
If a FEN tag is used, a separate tag pair SetUp must also appear and have its value set to 1.

Movetext

Chessboard notation SCD algebraic notation.svg
Chessboard notation

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 x if there is a capture, and the two-character algebraic name of the final square the piece moved to. The letter abbreviations are K (king), Q (queen), R (rook), B (bishop), and N (knight). The pawn is given an empty abbreviation in SAN movetext, but in other contexts the abbreviation P 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 a1, the rightmost square closest to the white is h1, and the rightmost (from white's perspective) square closest to black side is h8.

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, Nge2 specifies that the knight originally on the g-file moves to e2.

SAN kingside castling is indicated by the sequence O-O; queenside castling is indicated by the sequence O-O-O (note that these are capital Os, not zeroes, contrary to the FIDE standard for notation). [4] Pawn promotions are notated by appending = to the destination square, followed by the piece the pawn is promoted to. For example: e8=Q. If the move is a checking move, + is also appended; if the move is a checkmating move, # is appended instead. For example: e8=Q#.

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:

[Event "F/S Return Match"][Site "Belgrade, Serbia JUG"][Date "1992.11.04"][Round "29"][White "Fischer, Robert J."][Black "Spassky, Boris V."][Result "1/2-1/2"]  1. e4 e5 2. Nf3 Nc6 3. Bb5 {This opening is called the Ruy Lopez.} 3... a6 4. Ba4 Nf6 5. O-O Be7 6. Re1 b5 7. Bb3 d6 8. c3 O-O 9. h3 Nb8 10. d4 Nbd7 11. c4 c6 12. cxb5 axb5 13. Nc3 Bb7 14. Bg5 b4 15. Nb1 h6 16. Bh4 c5 17. dxe5 Nxe4 18. Bxe7 Qxe7 19. exd6 Qf6 20. Nbd2 Nxd6 21. Nc4 Nxc4 22. Bxc4 Nb6 23. Ne5 Rae8 24. Bxf7+ Rxf7 25. Nxf7 Rxe1+ 26. Qxe1 Kxf7 27. Qe3 Qg5 28. Qxg5 hxg5 29. b3 Ke6 30. a3 Kd6 31. axb4 cxb4 32. Ra5 Nd5 33. f3 Bc8 34. Kf2 Bf5 35. Ra7 g6 36. Ra6+ Kc5 37. Ke1 Nf4 38. g3 Nxh3 39. Kd2 Kb5 40. Rd6 Kc5 41. Ra6 Nf2 42. g4 Bd3 43. Re6 1/2-1/2 

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.

See also

Related Research Articles

<span class="mw-page-title-main">Algebraic notation (chess)</span> Method to convey chess moves

Algebraic notation is the standard method for recording and describing the moves in a game of chess. It is based on a system of coordinates to uniquely identify each square on the board. It is used by most books, magazines, and newspapers.

<span class="mw-page-title-main">Fischer random chess</span> Chess variant invented by Bobby Fischer

Fischer random chess, also known as Chess960, is a variation of the game of chess invented by the former world chess champion Bobby Fischer. Fischer announced this variation on June 19, 1996, in Buenos Aires, Argentina. Fischer random chess employs the same board and pieces as classical chess, but the starting position of the pieces on the players' home ranks is randomized, following certain rules. The random setup makes gaining an advantage through the memorization of openings impracticable; players instead must rely more on their skill and creativity over the board.

Descriptive notation is a chess notation system based on abbreviated natural language. Its distinctive features are that it refers to files by the piece that occupies the back rank square in the starting position and that it describes each square two ways depending on whether it is from White or Black's point of view. It was common in English, Spanish and French chess literature until about 1980. In most other languages, the more concise algebraic notation was in use. Since 1981, FIDE no longer recognizes descriptive notation for the purposes of dispute resolution, and algebraic notation is now the accepted international standard.

This glossary of chess explains commonly used terms in chess, in alphabetical order. Some of these terms have their own pages, like fork and pin. For a list of unorthodox chess pieces, see Fairy chess piece; for a list of terms specific to chess problems, see Glossary of chess problems; for a list of named opening lines, see List of chess openings; for a list of chess-related games, see List of chess variants; for a list of terms general to board games, see Glossary of board games.

Circe chess is a chess variant in which captured pieces are reborn on their starting positions as soon as they are captured. The game was invented by French composer Pierre Monréal in 1967 and the rules of Circe chess were first detailed by Monréal and Jean-Pierre Boyer in an article in Problème, 1968.

Capablanca chess is a chess variant invented in the 1920s by World Chess Champion José Raúl Capablanca. It incorporates two new pieces and is played on a 10×8 board. Capablanca believed that chess would be played out in a few decades. This threat of "draw death" for chess was his main motivation for creating a more complex version of the game.

A fairy chess piece, variant chess piece, unorthodox chess piece, or heterodox chess piece is a chess piece not used in conventional chess but incorporated into certain chess variants and some chess problems. Compared to conventional pieces, fairy pieces vary mostly in the way they move, but they may also follow special rules for capturing, promotions, etc. Because of the distributed and uncoordinated nature of unorthodox chess development, the same piece can have different names, and different pieces can have the same name in various contexts. Most are symbolised as inverted or rotated icons of the standard pieces in diagrams, and the meanings of these "wildcards" must be defined in each context separately. Pieces invented for use in chess variants rather than problems sometimes instead have special icons designed for them, but with some exceptions, many of these are not used beyond the individual games for which they were invented.

Forsyth–Edwards Notation (FEN) is a standard notation for describing a particular board position of a chess game. The purpose of FEN is to provide all the necessary information to restart a game from a particular position.

<i>En passant</i> Special pawn move in chess

In chess, en passant describes the capture by a pawn of an enemy pawn on the same rank and an adjacent file that has just made an initial two-square advance. The capturing pawn moves to the square that the enemy pawn passed over, as if the enemy pawn had advanced only one square. The rule ensures that a pawn cannot use its two-square move to safely skip past an enemy pawn.

Chess notation systems are used to record either the moves made or the position of the pieces in a game of chess. Chess notation is used in chess literature, and by players keeping a record of an ongoing game. The earliest systems of notation used lengthy narratives to describe each move; these gradually evolved into more compact notation systems. Algebraic notation is now the accepted international standard, with several variants. Descriptive chess notation was used in English- and Spanish-language literature until the late 20th century, but is now obsolescent. Portable Game Notation (PGN) is a text file format based on English algebraic notation which can be processed by most chess software. Other notation systems include ICCF numeric notation, used for international correspondence chess, and systems for transmission using Morse code over telegraph or radio. The standard system for recording chess positions is Forsyth–Edwards Notation (FEN).

ICCF numeric notation is the official chess notation system of the International Correspondence Chess Federation. The system was devised for use in international correspondence chess to avoid the potential confusion of using algebraic notation, as the chess pieces have different abbreviations depending on language.

<span class="mw-page-title-main">Crazyhouse</span> Chess variant with drops

Crazyhouse is a chess variant in which captured enemy pieces can be reintroduced, or dropped, into the game as one's own. It was derived as a two-player, single-board variant of bughouse chess.

<span class="mw-page-title-main">Cylinder chess</span> Chess variant

Cylinder chess is a chess variant. The game is played as if the board were a cylinder, with the left side of the board joined to the right side. Cylinder chess is one of six chess variants described by the Arabic historian Ali al-Masudi in 947.

X-FEN is an extension of Forsyth–Edwards Notation (FEN) introduced by Reinhard Scharnagl in 2003. It was designed to be able to represent all possible positions in Fischer random chess (FRC) and Capablanca random chess (CRC). It is fully backward compatible with FEN.

Los Alamos chess is a chess variant played on a 6×6 board without bishops. This was the first chess-like game played by a computer program. This program was written at Los Alamos Scientific Laboratory by Paul Stein and Mark Wells for the MANIAC I computer in 1956. The reduction of the board size and the number of pieces from standard chess was due to the very limited capacity of computers at the time.

<span class="mw-page-title-main">Millennium 3D chess</span> Three-dimensional chess variant

Millennium 3D chess is a three-dimensional chess variant created by William L. d'Agostino in 2001. It employs three vertically stacked 8×8 boards, with each player controlling a standard set of chess pieces. The inventor describes his objective as "extending the traditional chess game into a multilevel environment without distorting the basic game."

<span class="mw-page-title-main">Wildebeest chess</span>

Wildebeest chess is a chess variant created by R. Wayne Schmittberger in 1987. The Wildebeest board is 11×10 squares. Besides the standard chess pieces, each side has two camels and one "wildebeest" - a piece which may move as either a camel or a knight.

<span class="mw-page-title-main">Hostage chess</span> Chess variant

Hostage chess is a chess variant invented by John A. Leslie in 1997. Captured pieces are not eliminated from the game but can reenter active play through drops, similar to shogi. Unlike shogi, the piece a player may drop is one of their own pieces previously captured by the opponent. In exchange, the player returns a previously captured enemy piece which the opponent may drop on a future turn. This is the characteristic feature of the game.

Dynamo chess is a chess variant invented by chess problemists Hans Klüver and Peter Kahl in 1968. The invention was inspired by the closely related variant push chess, invented by Fred Galvin in 1967. The pieces, board, and starting position of Dynamo chess are the same as in orthodox chess, but captures are eliminated and enemy pieces are instead "pushed" or "pulled" off the board. On any given move, a player can make a standard move as in orthodox chess, or execute a "push move" or a "pull move". A move that is either a push move or a pull move is called a "dynamo move".

<span class="mw-page-title-main">Shogi notation</span> Notation system for Shogi

Shogi notation is the set of various abbreviatory notational systems used to describe the piece movements of a shogi game record or the positions of pieces on a shogi board.

References

  1. "Standard: Portable Game Notation Specification and Implementation Guide". Internet Archive. 12 March 1994. Retrieved 25 July 2020. The page linking to the document is here.
  2. The Rise of Internet Chess, Mark Weeks' chess pages
  3. For example, the PGN generated by lichess for the online match between grandmasters Pavel Smirnov and Andrew Tang (2020) lists a URL in the site field.
  4. Burgess, Graham (2000) [1997], The Mammoth Book of Chess, Carroll & Graph, p. 517, ISBN   0-7867-0725-9, The main differences from standard Algebraic are that there is both a dot and a space after each move number, and an upper case "O" is used instead of a zero in the notation for castling.