pgnlib: a c++ library for PGN chess games

Tutorial - 1


1. An introduction to Portable Game Notation

This is a chess game written in Portable Game Notation

[Event "Match 3"]
[Site "London ENG"]
[Date "1834.??.??"]
[Round "3"]
[White "De la Bourdonnais, Louis C"]
[Black "MacDonnell, Alexander"]
[Result "1-0"]
[ECO "D20g"]

1.d4 d5 2.c4 dxc4 3.e3 e5 4.Bxc4 exd4 5.exd4 Nf6 6.Nc3 Be7 
7.Nf3 O-O 8.h3 Nbd7 9.Be3 Nb6 10.Bb3 c6 11.O-O Nfd5 12.Qe2 
f5 13.Rae1 g5 14.Bd2 Bf6 15.Ne5 Qe8 16.f4 g4 17.hxg4 fxg4 
18.f5 Qh5 19.Bc2 Qh4 20.Qe4 Kh8 21.Nxg4 Nc4 22.Nxf6 Qxf6 
23.Nxd5 cxd5 24.Qf4 Nxd2 25.Qxd2 Bd7 26.Re5 Rg8 27.Rfe1 Qh4 
28.R1e2 Bb5 29.Rf2 Rg4 30.f6 Rxd4 31.Qe3 Rg4 32.Re7 d4 
33.Qe5 Rg5 34.f7+ Rxe5 35.f8=Q+ Rxf8 36.Rxf8# 1-0

If you are a chess player who is accustomed to algebric chess notation you should find the above quite intuitive.

Basically we have two main sections, separated by a blank line: a tag list providing various information on the game, followed by the move list.

The game result is usually present in both the tag and the move list.

Other significant PGN features, not covered by this sample game, are comment text, variations, and more.

Some of these features are currently not covered by pgnlib, they will (hopefully) in future releases.

For further information and details on PGN specification consult the pgn standard.

[Home] [2. The pgnlib classes]


SourceForge.net Logo Valid HTML 4.01!