SGF
SGF is an abbreviation for Smart Game Format, which has become a common file format.
Table of contents |
About the format
The SGF file format is designed to store game records of board games for two players. It's a text-only, tree-based format.
Games stored in SGF format can easily be emailed, posted or processed with text-based tools.
The main purposes of SGF are to store records of played games and to provide features for storing annotated and analyzed games (e.g. board markup, variations).
Furthermore, a lot of information about the game can be added to a SGF file:
- Name: name of the game record
- Size: size of the board, non square boards are supported
- Komi: komi
- White Name: name of the white player
- White Rank: rank of the white player
- Black Name: name of the black player
- Black Rank: rank of the black player
- White Team: name of the white team
- Black Team: name of the black team
- Result: result, usually in the format "B+R" (black wins by resign) or "B+3.5" (black wins by 3.5 moku)
- Date: date of the game
- Event: name of the event (e.g. 58th Honinbo Title Match)
- Place: place where the game was played (e.g.: Tokyo)
- Round: round (e.g.: 5th game)
- Rules: ruleset (e.g.: japanese)
- Time limit: time limit in seconds
- Opening: information about the opening (fuseki), rarely used in any file
- Overtime: overtime system
- Annotations: name of the person commenting the game
- User: name of the person who created the SGF file
- Copyright: copyright information
- Source: source of the file
- Application: application that was used to create the file (e.g. CGOban2,...)
There is no strict checking of the contents of these tags, so it is possible to put any text into the result tag for example.
SGF format example
This is an example of a tsumego problem stored in SGF format. Please note that this example comes from GoProblems. See that site for copyright information.
( ;GM[1]FF[3] RU[Japanese]SZ[19]HA[0]KM[5.5] PW[White] PB[Black] GN[Copyright goproblems.com] DT[1999-07-21]TM[1800] ;C[Black to play and live.] AW[bb][cb][cc][cd][de][df][cg][ch][dh][ai][bi][ci] AB[ba][ab][ac][bc][bd][be][cf][bg][bh] (;B[af];W[ah] (;B[ce];W[ag] C[only one eye this way])
(;B[ag];W[ce]) )
(;B[ah];W[af] (;B[ae];W[bf];B[ag];W[bf] (;B[af];W[ce] C[oops! you can't take this stone])
(;B[ce];W[af];B[bg] C[RIGHT black plays under the stones and lives]) )
(;B[bf];W[ae]) )
(;B[ae];W[ag])
)
Specific tools
-
sgfMerger by Bill Shubert. A command-line java program that combines multiple SGF games into a single SGF file. It is useful to create a game collection for distribution in a single SGF file. But it does not merge two SGFs which are based upon the same game into one SGF.
Other software that can handle SGF
-
Go4Go's
SGF Replayer is a Go game record reader written in Java. It is designed to be a convenient tool to replay Go games and read game commentaries.
- CGoban1 can be used as an SGF editor as well as its primary role as the client for IGS, NNGS and other Go servers.
- CGoban 2 can be used as an SGF editor as well as its primary role as the client for KGS.
- qGo can be used as an SGF editor as well as its primary role as a client for IGS.
- SGF Organizer is (or will be) a tool to store your game records in a searchable database
- GoAssistant
-
Goban, for Mac OS X, can be used an an SGF editor, as an IGS client, as a client for local network, or for games against the included GnuGo.
Notes
Most Go servers are able to send you an SGF file of a game you played. SGF files are used by many Go editing programs and are even used on rec.games.go.
Sensei's Library also uses SGF files - all the diagrams on SL can be downloaded as SGF simply by clicking on them (see How Diagrams Work).
Links
- Specification:
http://www.red-bean.com/sgf/
-
SGF user guide including lists on SGF's
Go
properties (
by type) -- by Arno
-
SGFC: SGF syntax checker and converter -- by Arno
-
- Definition of the Smart-Go Format From the Dissertation of Anders Kierulf:
http://www.britgo.org/nsw/text/sg-def.html
- CPAN's
SGF module for Perl
- SGF Summarizer, with Python code and SGF parser library.
http://gotools.sourceforge.net/sgfsummary/
- The GO Tools Project
http://gotools.sourceforge.net/