[SGF FF[4] - Smart Game Format]

Draft: SGF Style Guide (FF[3])

The goal of this guide is to provide a uniform look and feel for building game collections. If you have any suggestions or comments, please mail me: mueller@inf.ethz.ch

Game tree structure

The first branch is the main branch!

The first (leftmost) branch of the game tree should always be the real game. Variations should go into other branches.
Correct: The game comes first
(;B[cb];N[The game]W[db];B[bd])
(;B[ec]N[Diagram 1];W[cb])
Wrong: the variation comes first, the game is in the side branch
(;B[ec]N[Diagram 1];W[cb])
(;B[cb];N[The game]W[db];B[bd])
Comment Antoine de Maricourt:
Good !

Cleaning up

Omit extra pass plays and empty nodes at the end of the game. The last node of the game should contain the last move on the board. Do not put game information such as 'Black wins and connects Ko' into the comment field, rather add another move to the game which connects the Ko. In this case, two consecutive moves by the same color should be used, rather than a 'capture Ko, Pass, Connect' sequence. Pass plays which are in the game record and followed by non-pass plays should be given.

Differences between current SGF viewers

A good summary can be found in Bill Hosken's documentation on the teaching ladder.

Move and Setup properties

Do not mix move and setup properties in the same node. A setup property indicates a radical change in the board position. If a move suffices, use a move.

Setup props will rarely be used after moves have already been played, except for a 'what-if' type of analysis (see below). The usual usage will be:

Especially, the AddEmpty property will rarely be used.

Antoine de Maricourt mentions one possibility:

Variations and alternative moves

There are many ways to display variations on the screen. You can show alternatives to the current move, or different follow-up moves. There is only one way, however, to store variations in an SGF file: use the tree structure.

Put alternative moves at the same tree level

Some popular SGF viewers seem to do the following: To show alternatives to the current move, they add a child node (i.e. a follow-up move), remove the current move by using an AddEmpty[] property and put the other move into the node.
Correct: Both black moves are on the same level
(;B[cb];N[The game]W[db];B[bd])
(;B[ec]N[Diagram 1];W[cb])
Wrong: the second black move is on the wrong tree level
(;N[The game]W[db];B[bd])
(;AE[cb]N[Diagram 1]B[ec];W[cb])
Comment Antoine de Maricourt:
Right !



Please use the ISO-standard format "YYYY-MM-DD" for the date field. Dates in this format can be sorted alphanumerically. Do not use other separators such as "/", " " or ".". For games that last more than one day, we recommend adding the other dates as follows: Use "YYYY-MM-DD,DD" if the month is the same. Use "YYYY-MM-DD,MM-DD" if the month is different, year is the same. Use "YYYY-MM-DD,YYYY-MM-DD" if the year is different.


Use "0" (zero) for a draw (jigo), "B+score" for a black win, and "W+score" for a white win, e.g. "B+2.5", "W+64". Use .5, not 1/2. For half point results, the format "B+0.5", "W+0.5" is suggested.
Use "B+R" and "W+R" for a win by resignation. Please do not write "Black resigns", as a sorting algorithm may think Black is the winner. Use "B+T" and "W+T" for a win on time, "B+F" and "W+F" for a win by forfait, "?" for unknown result.

Event, ID, etc.: Identifying a game

From Jan:
The EV[] tag
When exchanging pro games we could compile a list of "official"
EV[] events. We can use the indices which I created for the WWW
pages for the major Japanese titles to start with:
When encoding a Tengen game, the appropriate entry for the EV[]
key would be one of the entries in the list:

        1st Tengen
        2nd Tengen
        20th Tengen

Other titles similarly.

The ID[] tag
I like the way you used it, although I would add the century to it.
Another story is the league games. How to classify them? I have no
idea (yet).

Comment MM: I used 'YY/Round' as an ID tag. For some leagues (Honinbo, Meijin) there is a canonical number (as in Kido yearbook), so the ID might be YYYY/L/number, with the L indicating the league. For other tournaments, sort by some canonical order? E.g. date, black placer, white player.


Names, events, and places should be spelled consistently in all games.

**** Use canonical spelling page on WWW, Jan?

Last modified: Mar 9, 1995

Martin Müller, mueller@inf.ethz.ch