games sgf go
Tags
NAME
Games::SGF - A general SGF parser
VERSION
Version 0.993
SYNOPSIS
use Games::SGF;
my $sgf = new Games::SGF();
$sgf->setStoneRead( sub { "something useful"} );
$sgf->setMoveRead( sub { "something useful"} );
$sgf->setPointRead( sub { "something useful"} );
$sgf->addTag('KM', $sgf->T_GAME_INFO, $sgf->V_REAL );
$sgf->readFile("015-01.sgf");
$sgf->setProperty( "AP", $sgf->compose("MyApp", "Version 1.0") );
DISCRIPTION
Games::SGF is a general Smart Game Format Parser. It parses the file, and checks the properties against the file format 4 standard. No game specific features are implemented, but can be added on in inheriting classes.
It is designed so that the user can tell the parser how to handle new tags. It also allows the user to set callbacks to parse Stone, Point, and Move types. These are game specific types.
SGF Structure
SGF file contains 1 or more game trees. Each game tree consists of a sequence of nodes followed by a sequence of variations. Each variation also consists a sequence of nodes followed by a sequence of variations.
Each node contains a set of properties. Each property has a Type, Value Type, Flags, and an Attribute.
Interface
The interface is broken into 3 conceptal parts
SGF Format
This is the straight SGF Format which is saved and read using IO methods.
User Format
This is the format that the Games::SGF user will come in contact with. Various methods will convert the Uwer Format into the Internal Format which Games::SGF actually deals with.
These can take the form of Constants:
-
Double Values: DBL_NORM and DBL_EMPH
-
C_BLACK and C_WHITE
Or with converstion methods:
-
compose
-
move
-
stone
-
point
Internal Format
If this format differs from the others, you don’t need to know.