Smart Game Format

   

Smart Game Format
Author: Anders Kierulf (1987, FF1), Martin Mueller (1993, FF3), Arno Hollosi (1997, FF4)
License: [ext] OpenContent License[1]
Category: format specification
Operating system:
Stable Version: 4 (1997)
Last beta: 5 (still discussion)
Development status: sleeping
Homepage: [ext] https://red-bean.com/sgf/
Infos last checked:

Smart Game Format is a common format to store Go game records. While it was initially developed for Go, it has since been extended to many other games, thus it is incorrect to still call it Smart Go Format.

The format exists now since 1987. Since then it was discussed in newsgroups and bulletin boards and reached FF[4] in the late 1990s.

Most Go servers are able to send you a SGF file of a game you played. SGF files are used by many Go editing programs and are even used on rec.games.go. An extension of SGF was used for Smart Go Books, though the format has subsequently changed.

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).

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).

SGF files are comprised of pairs of properties and property values, each of which describes a feature of the game. A partial list appears below. Full information can be found using the references in the Links section below.

  • AB: Add Black: locations of Black stones to be placed on the board prior to the first move.
  • AW: Add White: locations of White stones to be placed on the board prior to the first move.
  • AN: Annotations: name of the person commenting the game.
  • AP: Application: application that was used to create the SGF file (e.g. CGOban2,...).
  • B: a move by Black at the location specified by the property value.
  • BR: Black Rank: rank of the Black player.
  • BT: Black Team: name of the Black team.
  • C: Comment: a comment.
  • CP: Copyright: copyright information. See Kifu Copyright Discussion.
  • DT: Date: date of the game.
  • EV: Event: name of the event (e.g. 58th Honinbo Title Match).
  • FF: File format: version of SGF specification governing this SGF file.
  • GM: Game: type of game represented by this SGF file. A property value of 1 refers to Go.
  • GN: Game Name: name of the game record.
  • HA: Handicap: the number of handicap stones given to Black. Placement of the handicap stones are set using the AB property.
  • KM: Komi: komi.
  • ON: Opening: information about the opening (fuseki), rarely used in any file.
  • OT: Overtime: overtime system.
  • PB: Black Name: name of the black player.
  • PC: Place: place where the game was played (e.g.: Tokyo).
  • PL: Player: color of player to start.
  • PW: White Name: name of the white player.
  • RE: Result: result, usually in the format "B+R" (Black wins by resign) or "B+3.5" (black wins by 3.5 moku).
  • RO: Round: round (e.g.: 5th game).
  • RU: Rules: ruleset (e.g.: Japanese).
  • SO: Source: source of the SGF file.
  • SZ: Size: size of the board, non square boards are supported.
  • TM: Time limit: time limit in seconds.
  • US: User: name of the person who created the SGF file.
  • W: a move by White at the location specified by the property value.
  • WR: White Rank: rank of the White player.
  • WT: White Team: name of the White team.

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.

other info:

Historical note: The first version of SGF, FF[1], was conceived by Anders Kierulf in 1987. It is Appendix A in his Ph.D. thesis (see here: [ext] https://britgo.org/tech/sgfspec.html). FF[3] was written by Martin Muller? in 1993. The current version of the SGF is FF[4] by Arno Hollosi, and is supported by most current SGF readers. FF[2] was never made public.

Development: FF[4] is outdated, but has not been replaced by something more recent. Today UTF-8 is standard, not Latin-1. The DT property needs the possibility to indicate a time. The TM property needs a unit. For a (dormant) proposal, see [ext] The SGF Format.


Coordinate system for points and moves

The first letter designates the column (left to right), the second the row (top to bottom). The upper left part of the board is used for smaller boards, e.g. letters "a"-"m" for 13*13.

The author intentionally broke with the tradition of labeling moves (and points) with letters "A"-"T" (excluding "i") and numbers 1-19. Two lowercase letters in the range "a"-"s" were used instead, for reasons of simplicity and compactness.

(Column before row follows the principle "horizontal before vertical" used in x-y coordinate systems. The upper left corner as origin of the board corresponds to the way we read, and most modern computers use it as origin of the screen coordinates to simplify integration of text and graphics.)

SGF format example

This is an example of a tsumego problem stored in SGF format. Please note that this example comes from [ext] GoProblems. See that site for copyright information. Keep in mind, that line breaks are not needed for sgf, so all can be on one line!

(;FF[4]GM[1]SZ[19]
GN[Copyright goproblems.com]
PB[Black]
HA[0]
PW[White]
KM[5.5]
DT[1999-07-21]
TM[1800]
RU[Japanese]
;AW[bb][cb][cc][cd][de][df][cg][ch][dh][ai][bi][ci]
AB[ba][ab][ac][bc][bd][be][cf][bg][bh]
C[Black to play and live.]
(;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]))

SGF Software

  • 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 3 (and its predecessor CGoban 2) can be used as an SGF editor as well as its primary role as the client for KGS.
  • EidoGo is a web-based SGF editor (allows uploads and saving changes on the server)
  • Drago is a reliable, freeware editor (recommended !!); it supports multiple games in a file.
  • glGo Can be used as an editor, to play aganist GnuGo and to play in IGS. Has a 2D and a 3D goban.
  • GoAssistant
  • Goban [ext] http://www.sente.ch/software/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.
  • GoGinkgo is a cross-platform web-based SGF editor written in Javascript.
  • Goissa an SGF viewer for Mac OS X. It works with board sizes from 5x5 up to 37x37
  • GokifuCom is a web-based SGF storing software (allows uploads /convert from UGI , GO, GIB, NGF ) contains embedded player
  • GoHome [ext] http://www.reisz.de/gohome.htm
    • many features, gtp protocol, problem files, 6x6 solution, printing and exporting diagrams, can create problem files, pattern search, allows sgf source code level editing, document/view architecture, is fast (windows)
  • GoRilla ( Windows. ) A free SGF game editor for Go, Connect6 and other games.
  • Jacoto Create your own database of games.
  • Jago, a free (GPL Licence) Java Go Client and SGF editor.
  • Kombilo A pattern searcher for go games.
  • MultiGo
  • qGo can be used as an SGF editor as well as its primary role as a client for IGS.
  • [ext] SGF Replayer, by Go4Go's [ext] http://www.go4go.net/, 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.
  • SmartGo The SGF editor by the inventor of SGF.
  • SGF Shell Extension?[ext] http://www.gomasch.de/sgfshellex : Extension for MS-Explorer to display properties of SGF files
  • Universal 3D Chess [ext] http://www.voilamonsieur.com : SGF editor in 2D/3D - GTP Support (Windows)
  • WebGoBoard? [ext] http://webgoboard.com/ is a web-based SGF editor
  • Weiqi2Go app SGF Reader and library for Apple devices(iOS)

See SGF-editor for a longer list of SGF editors and clients.


Web Viewers

The following is a list of programs that can be used to allow website visitors to view SGF files. Another list of viewers can be found at [ext] http://herebox.org/go/tools/.


Special tools (file format conversion etc.)

  • [ext] sgfutils. Various small utilities. Split game collections. Merge records of the same game. Search a database of games for a given pattern. Create diagrams. Convert UGF to SGF.
  • CommentFilter This Perl program allows you to strip unwanted comments from an SGF file downloaded from KGS.
  • RemoveTag This Perl program allows you to strip unwanted properties from an SGF file, plus any empty Comment tags.
  • Games-Go-Sgf2Dg convert Smart Go Format (SGF) files to diagrams similar to those seen in Go books and magazines.
  • [ext] SgfMan. A must-have for those using PilotGOne and Go for PalmOS, specifically because, among its other features, it's capable of converting SGF files on a memory card into MemoPad files which can then be read by the aforementioned programs.
  • [ext] 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.
  • [ext] http://www.set1.org/sgf/ (under development) seems to present the possibility to send SGF as a URL, so the receiver does not need an SGF viewer. Can be handy on turn-based servers. 19x19, no variations

More sgf tools are listed on these pages:


SGF libraries in various languages


MIME type

The MIME type of SGF files is: application/x-go-sgf


See also

on sgf:

other formats:


Remarks

[1] License named here: [ext] https://red-bean.com/sgf/user_guide/


Smart Game Format last edited by 2.87.81.117 on February 26, 2024 - 17:25
RecentChanges · StartingPoints · About
Edit page ·Search · Related · Page info · Latest diff
[Welcome to Sensei's Library!]
RecentChanges
StartingPoints
About
RandomPage
Search position
Page history
Latest page diff
Partner sites:
Go Teaching Ladder
Goproblems.com
Login / Prefs
Tools
Sensei's Library