GO Tools

Smart Game Format Parser Library: sgflib.py

version 1.0 (2000-03-26)

Homepage: http://gotools.sourceforge.net

Copyright (C) 2000 David John Goodger (mailto:goodger@python.org; davidg on NNGS, IGS, goclub.org). sgflib.py comes with ABSOLUTELY NO WARRANTY. This is free software, and you are welcome to redistribute it under the terms of the GNU Lesser General Public License; see the source code for details.


This library contains a parser and classes for SGF, the Smart Game Format. SGF is a text only, tree based file format designed to store game records of board games for two players, most commonly for the game of go. (See the official SGF specification at http://www.POBoxes.com/sgf/).

Given a string containing a complete SGF data instance, the SGFParser class will create a Collection object consisting of one or more GameTrees (one GameTree per game in the SGF file), each containing a sequence of Nodes and (potentially) two or more variation GameTrees (branches). Each Node contains an ordered dictionary of Property ID/value pairs (note that values are lists, and can have multiple entries).

Tree traversal methods are provided through the Cursor class.

The default representation (using str() or print) of each class of SGF objects is the Smart Game Format itself.

Return to the Smart Game Format Parser Library main page

Return to the SGF Summarizer main page

Return to the Go Tools main page

Go Tools project page

Project administrator: David Goodger

page last updated: 2000-03-27

Hosted by SourceForge.net

123count.com : counter and tracker