Games::Go::Diagram is a Perl extension to make go diagrams similar to printed diagrams.
my $diagram = Games::Go::Diagram->new (options);
$diagram->put($coords, 'white' | 'black', ? number ?);
my $new_diagram = $diagram->next;
A Games::Go::Diagram object represents a diagram similar to those seen in go textbooks and magazines. Most of the properties defined in SGF FF are supported.
The caller puts 'white' or 'black' stones (possibly numbered), on the intersection selected by $coords. The caller may mark and label intersections and stones.
put, mark, label and property are 'actions'. Actions are provisional until the node method is called. If any provisioanl actions cause a conflict, none of the actions associated with the node are applied, and the node method either calls a user-defined callback function, or returns an error.
When a conflict occurs, the caller should dispose of the current Diagram by getting the information from each intersection and doing something (like printing it). Then the caller converts the Diagram to the starting point of the next diagram by calling the clear method. Alternatively, the caller may save the current Diagram and create the starting point for the next diagram by calling the next method. clear and next may also be called at arbitrary times (for example, to launch a variation diagram).
'coords' may be any unique identifier for the intersection. For example:
my $coords = 'qd'; # SGF format
my $coords = 'a4'; # NNGS / IGS style coordinates
my $coords = "$x,$y"; # real coordinates
my $coords = 'George'; # as long as there's only one George