The notation used to described a chess game follows the standard PGN format, and can be automatically generated by the main chess database softwares, including Chessbase, Scid, etc. This page presents the features of the PGN format as used by the RPB Chessboard plugin.

General syntax

[Event "Linares 16<sup>th</sup>"]
[Site "Linares, ESP"]
[Date "1999.02.25"]
[Round "4"]
[White "Kasparov, Garry"]
[Black "Kramnik, Vladimir"]
[Result "1/2-1/2"]
[WhiteElo "2812"]
[BlackElo "2751"]
[WhiteTitle "WCH"]
[BlackTitle "GM"]
[Annotator "yo35"]

1.d4 Nf6 2.c4 e6 3.Nc3 Bb4 4.Qc2 d5 5.cxd5 Qxd5 6.Nf3 Qf5 7.Qxf5 exf5 8.a3 Be7 9.Bg5 Be6 10.e3 c6 11.Bd3 Nbd7 12.O-O h6 13.Bh4 a5 14.Rac1 O-O 15.Ne2 g5 16.Bg3 Ne4 17.Nc3 Nxc3 18.Rxc3 Nf6 19.Rcc1 Rfd8 20.Rfd1 Rac8 1/2-1/2

PGN is a text format allowing to describe chess game. Each game starts with a few headers defining some meta-data on the game (name of the players, date, tournament…). The list of moves follows the headers, and the result ends the game. The PGN format defines 7 standard headers:

  • Event: usually the name of the tournament.
  • Site: where the game takes place.
  • Date: starting date of the game, in format YYYY.MM.DD. If the day of month or the month are unknown, they can be replaced by ?? (for instance: 2022.??.??).
  • Round: playing round ordinal of the game within the tournament.
  • White / Black: name of the players.
  • Result: result of the game. It must be 1-0 (white wins), 0-1 (black wins), 1/2-1/2 (draw), or * (no result, for instance for an ongoing game). This header must be identical to the result indicated at the end of the game.

RPB Chessboard supports 5 additional headers commonly used by chess softwares:

  • WhiteElo / BlackElo: ratings of the players.
  • WhiteTitle / BlackTitle: titles of the players.
  • Annotator: name of the annotator (if the game contains annotations or comments).

HTML tags are allowed in headers (for instance: see the Event header in the above example).

Chess assessment symbols

1.e4 e5 2.Nf3 f6 $2 3.Nxe5 ! fxe5 4.Qh5+ Ke7 5.Qxe5+ Kf7 6.Bc4+ $18 *

Moves can be decorated with the usual chess assessment symbols, as in the above example (see Black’s 2nd move and White’s 3rd and 6th moves). In the PGN text, a chess assessment symbol is supposed to be defined by a dollar character followed by a numeric code: this notation is called a Numeric Annotation Glyph (aka. NAG) in the PGN format specification.

However, for the sake of readability, there are a few human-readable aliases that may be used in place of their corresponding NAGs (in the above example, symbol ! at White’s 3rd move is an alias for NAG $1). See the dedicated page for the list of chess assessment symbols supported by RPB Chessboard.

Text comments

1.d4 {I'm a <em>short-style</em> comment.} 1...Nf6 2.c4 e6 3.Nc3 Bb4 4.Qc2 d5 5.cxd5 Qxd5 6.Nf3 Qf5 7.Qxf5 exf5 8.a3 Be7 9.Bg5 Be6 10.e3 c6 11.Bd3 Nbd7 12.O-O h6 13.Bh4

{I'm a <em>long-style</em> comment.}

13...a5 14.Rac1 O-O 15.Ne2 g5 16.Bg3 Ne4 17.Nc3 Nxc3 18.Rxc3 Nf6 19.Rcc1 Rfd8 20.Rfd1 Rac8 *

Text comments can be inserted, surrounded with brace characters. HTML tags are allowed in text comments. RPB Chessboard supports two styles of text comments:

  • Long-style: the comment is rendered as a separated paragraph,
  • Short-style: the comment is rendered inlined within the move sequence.

A text comment is rendered using the long-style if it is preceded by a blank line in PGN. Otherwise, it is rendered using the short-style.

Variations

1.e4 e5 (1...c5) (1...e6) 2.Nf3 Nc6 3.Bb5

(3.Bc4 Bc5 (3...Be7) 4.d4)

(3.d4 exd4 4.Nxd4 Bc5 5.Be3 Qf6)

3...a6 4.Ba4 *

Sub-variations can be inserted, surrounded by parenthesis characters. RPB Chessboard supports nested sub-variations (i.e. a sub-variation within another sub-variation), with no limit on the nesting depth. As for text comments, sub-variations are rendered using either the long-style or the short style depending on whether they are preceded by a blank line in PGN or not.

Diagrams

1.e4 c5

{[#] This opening is called the Sicilian defence. A possible continuation is:}

2.Nf3 d6 *

Diagrams can be inserted using [#] in text comments. However, notice that the PGN format does not define any “official” encoding for chess diagrams. The convention used by RPB Chessboard is the same as the one used by Chessbase, but other softwares may have distinct ways to insert chess diagrams in PGN.

Custom initial position

[SetUp "1"]
[FEN "k7/n1PB4/1K6/8/8/8/8/8 w - - 0 50"]

{[#]}

50.Bc6+ Nxc6 51.c8=Q+ Nb8 52.Qb7# 1-0

It is possible to make the game start at a position different from the usual initial one, using the [FEN "..."] header. The custom initial position is described in this header using the FEN notation. Also, if a game contains a [FEN "..."] header, the convention defined by the PGN format requires that it contains also a [SetUp "1"] header.

Null moves

1.e4 -- 2.Nf3 -- 3.Bc4 -- 4.Nc3 -- 5.d4 -- 6.O-O *

A -- token in the move list allows to skip the underlying move.

Chess variants

[SetUp "1"]
[FEN "qbnnrkbr/pppppppp/8/8/8/8/PPPPPPPP/QBNNRKBR w KQkq - 0 1"]
[Variant "Chess960"]

{[#]}

1.f4 Nd6 2.Bc5 Nc6 3.O-O O-O-O *

RPB Chessboard supports several chess variants: see the dedicated page for more information. A chess variant game must be identified with the [Variant "..."] header in the PGN.

References