Arimaa Forum (
Arimaa >> Site Discussion >> Sorta real PGN please
(Message started by: Janzert on Sep 5th, 2009, 9:56pm)

Title: Sorta real PGN please
Post by Janzert on Sep 5th, 2009, 9:56pm
I'm starting work on adding the ability for some of my stuff to read and/or write movelists. Rather than use raw movelists though I figured it would be good to handle actual PGN format games. Especially since I recalled that the site had a link ( for getting the PGN of any game in the database. Unfortunately the output doesn't seem to conform at all to the PGN format.

Of course standard PGN is pretty chess specific and will have to be modified for Arimaa use. But I think it would be nice if we can keep as much as possible the same. Specifically the two things I would really like to have are the following.

Same tag pair format. In PGN parlance the header information is called the tag pairs section.
The current script seems to use

name: value

The PGN standard is

[name "value"]

Include the move text game termination marker.
The current script doesn't include any marker at the end of the movelist.
The PGN standard specifies the same marker as used in the Result tag, i.e. 1-0, 0-1, 1/2-1/2 or *.

One other thing it might be nice to have if the script is being modified would be to change the move colors to g/s from w/b. But any program for the foreseeable future will need to handle both anyway.

In case somebody would like to read about PGN a quick overview of PGN can be found at and the full specification at

If you want Omar, I'd be glad to modify the script to do any or all of the above.


p.s. One other thing I just noticed is that the current script has a tag called PlyCount that seems to actually be the number of moves instead of plies. I think I've seen this other places as well, but it would be nice to start eliminating it where possible.

Title: Re: Sorta real PGN please
Post by Fritzlein on Sep 6th, 2009, 7:54am
To me the most important part of a move list standard is its facility for annotating variations.  PGN allows one to put comments in braces, but the comments are intended to be text blobs.  If you do put an alternate line of play in a comment, you can't then branch it.  This is simply inadequate for serious commentary.

Apparently the PGN people are aware of this limitation, because their specification ( includes the following:

8.2.5 Movetext RAV (Recursive Annotation Variation)

An RAV (Recursive Annotation Variation) is a sequence of movetext containing one or more moves enclosed in parentheses. An RAV is used to represent an alternative variation. The alternate move sequence given by an RAV is one that may be legally played by first unplaying the move that appears immediately prior to the RAV. Because the RAV is a recursive construct, it may be nested.

*** The specification for import/export representation of RAV elements needs further development.

So if I understand the important delimiters, they are:
brackets: tags (can't be nested)
braces: comments (can't be nested)
parentheses: variations (can be nested)

I thought the commentary here ( would be a good example of annotated PGN, but for some reason the comments there are in brackets, not braces.  The trouble with standards is that everybody has one.

The annotation interface I am dreaming of when I talk about defining a standard is the ChessBase Light software which can be downloaded gratis here (  Of course I don't expect to see anything like that for Arimaa in the near future, but agreeing on a standard notation for annotating games seems like the first step to getting there.  If we have the standard, then any games created in a proto-interface can be exported to better interfaces later without loss.

Title: Re: Sorta real PGN please
Post by Janzert on Sep 6th, 2009, 10:47am
I'm not sure I understand what limitation you think PGN has. The game commentary you link to is basically a viewer for a PGN game with nested alternate lines of play, the raw pgn can be found here (

Yes, comments are raw text blobs. That's almost the definition of a comment to a programmer. ;) So basically the PGN doesn't hold the alternate line of play in the comment but rather the comment in the alternate line of play (and this sentence sounds like it should be a bad communist russia jokes).


Title: Re: Sorta real PGN please
Post by Fritzlein on Sep 6th, 2009, 12:38pm
OK, great, let's make that the standard.  :)

Title: Re: Sorta real PGN please
Post by aaaa on Sep 6th, 2009, 12:49pm
I can't speak from experience, but I understand that Smart Game Format (SGF) may have better variation support. Might want to look into it.

Title: Re: Sorta real PGN please
Post by Janzert on Sep 6th, 2009, 7:44pm
While I've only had minimal contact with SGF, and actually only slightly more with PGN, I've always been mildly repulsed by it. But only because I feel it's much less easily read and written by a human.

I believe both formats can represent the same set of variations since they both seem to represent the moves and variations as a tree structure.

I think SGF's advantage is that it's specifically designed to be game neutral and able to be easily used or at least extended for any game. Unfortunately I feel this is also the greatest disadvantage. An Arimaa SGF file will look quite similiar to other SGF files but quite unlike any current Arimaa format or notation.

I would love to hear from Don Dailey, David Fotland or anyone else that has significant use of both formats as to which they a) like better and b) would make a better base for an Arimaa format.


Title: Re: Sorta real PGN please
Post by Janzert on Sep 6th, 2009, 8:34pm
I decided to try doing a simple game in both formats. So here is game #19009 in both PGN and SGF.


[GameId "19009"]
[Event "Casual game"]
[Site "Over the Net"]
[Date "2005.09.2"]
[White "bot_ShallowBlue (Don Dailey)"]
[Black "bot_bash (Gerhard Trippen)"]
[Result "0-1"]
[Reason "Goal"]
[ResultCode "b"]
[ReasonCode "g"]

1w Da2 Hb2 Dc2 Md2 Ee2 Hf2 Cg2 Ch2 Ra1 Rb1 Rc1 Rd1 Re1 Rf1 Rg1 Rh1
1b ra8 rb8 rc8 rd8 re8 rf8 mg8 rh8 da7 hb7 cc7 cd7 de7 hf7 eg7 rh7
2w Ee2n Md2n Hb2n Da2n
2b eg7s eg6s eg5s
3w Cg2n Ch2n Ee3n Md3n
3b rh7s rh6s Cg3w eg4s
4w Cf3n Rh1n Hf2n Hf3w
4b eg3s Ch3w Cg3w eg2n
5w Cf4n Cf3n Ee4n Ee5n
5b rh5s eg3s eg2n Rh2w
6w Ee6e Ef6w hf7s hf6x Ra1n
6b Ee6e Ef6w hf7s hf6x Ra1n


EV[Casual game]
PC[Over the Net]
PW[bot_ShallowBlue (Don Dailey)]
PB[bot_bash (Gerhard Trippen)]

(;W[Da2 Hb2 Dc2 Md2 Ee2 Hf2 Cg2 Ch2 Ra1 Rb1 Rc1 Rd1 Re1 Rf1 Rg1 Rh1]
;B[ra8 rb8 rc8 rd8 re8 rf8 mg8 rh8 da7 hb7 cc7 cd7 de7 hf7 eg7 rh7]
;W[Ee2n Md2n Hb2n Da2n]
;B[eg7s eg6s eg5s]
;W[Cg2n Ch2n Ee3n Md3n]
;B[rh7s rh6s Cg3w eg4s]
;W[Cf3n Rh1n Hf2n Hf3w]
;B[eg3s Ch3w Cg3w eg2n]
;W[Cf4n Cf3n Ee4n Ee5n]
;B[rh5s eg3s eg2n Rh2w]
;W[Ee6e Ef6w hf7s hf6x Ra1n]
;B[Ee6e Ef6w hf7s hf6x Ra1n]

I may not have the SGF close to what it should really look like though, since I'm just going by a couple samples and the specification to write that.

The SGF actually is a little more readable than I thought it would be. It turns out, unlike I had thought, the move notation is completely game specific. One thing I'm not sure about and was a bit of a surprised by, is the time control information in SGF seems to be very Go specific and probably not usable for Arimaa time control information.


Title: Re: Sorta real PGN please
Post by Fritzlein on Sep 17th, 2009, 1:12pm
Hmmm, I forgot that the only move notation standard is the verbose one.  I guess it is difficult to raise the issue of PGN without resurrecting the issue of the move notation per se.  I will have to attend naveed's local Arimaa club and play a live game while recording moves in order to give another test to the notation I used in Beginning Arimaa.

Title: Re: Sorta real PGN please
Post by omar on Sep 23rd, 2009, 8:59pm
I really should not have called that PGN since the format is not exactly PGN. It was just inspired by looking at PGN. Probably should just call it AGN for Arimaa game notation. I had documented the slightly modified format on the notation page:

However that was all done at a time when data interchange formats like JSON were not common. If I were to do it now I would just use a well known data interchange format rather then defining our own so that we don't have to worry about writing code for encoding and decoding the format.

I just created this service which gives the fields of a game record in one of the standard formats:

Title: Re: Sorta real PGN please
Post by Janzert on Jan 25th, 2010, 11:30am
Just for the record, the reason I was looking to move toward a more correct PGN file was so various existing tools, in particular bayeselo, could be used directly. Of course with whatever format is standardized a script can be created to translate to the pgn files needed by those tools.


Arimaa Forum » Powered by YaBB 1 Gold - SP 1.3.1!
YaBB 2000-2003. All Rights Reserved.