Games-Go-Sgf2Dg

 view release on metacpan or  search on metacpan

lib/Games/Go/Sgf2Dg/Diagram.pm  view on Meta::CPAN

as a reference to a hash.  The keys of the hash indicate the items
of interest, and the values of the hash are the indices where the
item was applied, except where noted below.

Only keys that have been applied are returned - an empty hash means
an empty intersection.

The hash keys can be any of:

=over 4

=item 'hoshi'

This intersection is a hoshi point.  Note that since hoshi points
are determined at B<new> time, the value of this hash entry is
always 0.  This key is returned even if a stone has been placed on
the intersection.

=item 'white'

The color of a stone at this intersection.

=item 'black'

The color of a stone at this intersection.

=item 'number'

The hash value is the number on the stone.  The node for
B<number> is found in the 'black' or 'white' hash value.

=item 'capture'

The stone on this intersection has been B<capture>d, the
intersection is currently empty from the perspective of the game.

=item 'mark'

The intersection or stone is marked.  The value indicates the type of mark,
usually the SGF property:

=over 4

=item CR  circle

=item MA  an X mark

=item SQ  square

=item TR  triangle

=back

=item 'label'

The intersection has been labeled.  The value indicates the text of the
label.

=item 'overstones'

If this hash entry exists it means that one or more stones were overlayed
on the stone that is currently displayed on this intersection of the
B<Diagram>.

The hash value is a reference to an array of color/number pairs.
The colors and numbers were passed to the B<put> method which
decided to convert the stone into an overstone.

This is typically seen as notes to the side of the diagram saying
something like "black 33 was played at the marked white stone".  In
this example. the information returned by B<get> describes 'the
marked white stone', while 'black' will be the first item in the
'overstones' array, and '33' will be the second:

    $diagram->get($coords) == {white => node_number,
                               overstones => ['black', 33],
                               ...}

=item 'TB' or 'TW'

Intersection has been marked as black or white territory with a TB or TW
property.

=item 'view'

Set when the intersection is marked with a VW view property.  Relates to
the VW game B<property>:

    if ((not $diagram->property(0)->VW) or      # no game-level VieW property
         $intersection->{view}) {               # this intersection is viewable
       # display this intersection
    }

=back

The hash reference returned by B<get> points to the data in the
B<Diagram> object - don't change it unless you know what you are
doing.

=cut

sub get {
    my ($my, $coords) = @_;

    unless(defined($coords)) {
        carp("'get' expects a '\$coords' argument");
        return {};
    }
    return $my->{board}{$coords} || {};
}

=item my $coord_string = $diagram-E<gt>B<xcoord>($x)

=item my $coord_string = $diagram-E<gt>B<ycoord>($y)

Returns a string to display for a given $x or $y coordinate.  The string
returned depends not only on the $x or $y value, but also on the
B<coords_style> and B<boardSizeX/Y> configuration options,

=cut



( run in 0.530 second using v1.01-cache-2.11-cpan-cdf2f3d4e48 )