This is another blog in my continuing quest (inspired by Queen’s Gambit on Netflix and the wonderful character of Beth Harmon) to improve my chess and to find out more about some of the excellent books, web sites and other tools to help me on my journey

The topic this time is the notation format used to record the positions and moves of a game or a puzzle called the PGN format (Portable Game Notation)… not to be confused with the PNG (Portable Network Graphics) format, which is an image file format.

My interest is to find out what the ‘coding’ conventions are for the internal format and how to create them (using a simple text editor) so that I can quickly load a starting position for a game in one of the game analysis tools I use/have discovered recently. There is a very good overview on Wikipedia which can be found here (Good overview of the PGN format)

The internal format comprises two main sections:
Tag pairs – which describe the main attributes of the game e.g. who’s playing, where, when, etc.
Movetext – the moves that have been played to create the position in the game, puzzle, etc.

I found that I don’t use the ‘Tag pairs’ so much as I am usually only setting up a position that I can do some analysis on and its usually a snippet from a book or something I have seen somewhere.

What started me thinking about this was that I was finding the position editor on chess.com a little tedious, especially on my iPad, I guess the ‘user experience’ was not designed for a touch interface ๐Ÿ˜•

… since then I have found a much better position editor on a web site called liches.com – see A better board editor IMHO ๐Ÿ™‚

When I started learning about PGN notation I thought that each file only contained the details of a single game but I stumbled across a web site that had downloadable PGN files and each file had a number of games inside… I guess this means there must be some board editors that can handle this and help you choose which game you are after in the file but I have not found one yet, most editors I have seen just load the first game and ignore the rest.

So now I know how to create PGN files in a text editor and it makes it easy to set up a game board and load it into a chess program for analysis. Along the way I also discovered that some of the code editors I use e.g. Visual Studio Code (I use the Mac version) support creating/editing PGN files and have listing extensions such as this one on the Visual Studio marketplace. The colour coding provided by the linting extension helps me see if I have coded everything correctly when creating a PGN file.

That’s about all for this blog. If you read it and would like to share any info you have about PGN files, please feel free to post a comment below. Thanks for reading ๐Ÿ˜€

3 thoughts on “Chess game notation

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.