| 1 |
root |
1.1 |
NAME |
| 2 |
|
|
Games::Go::SimpleBoard - represent a simple go board |
| 3 |
|
|
|
| 4 |
|
|
SYNOPSIS |
| 5 |
|
|
use Games::Go::SimpleBoard; |
| 6 |
|
|
|
| 7 |
|
|
DESCRIPTION |
| 8 |
|
|
Please supply a description ) |
| 9 |
|
|
|
| 10 |
|
|
EXPORTED CONSTANTS |
| 11 |
|
|
Marker types for each board position (ORed together): |
| 12 |
|
|
|
| 13 |
|
|
MARK_TRIANGLE # triangle mark |
| 14 |
|
|
MARK_SQUARE # square mark |
| 15 |
|
|
MARK_CIRCLE # circle mark |
| 16 |
|
|
MARK_SMALL_B # small stone, used for scoring or marking |
| 17 |
|
|
MARK_SMALL_W # small stone, used for scoring or marking |
| 18 |
|
|
MARK_B # normal black stone |
| 19 |
|
|
MARK_W # normal whit stone |
| 20 |
|
|
MARK_GRAYED # in conjunction with MARK_[BW], grays the stone |
| 21 |
|
|
MARK_LABEL # a text label |
| 22 |
|
|
MARK_HOSHI # this is a hoshi point (not used much) |
| 23 |
|
|
MARK_MOVE # this is a regular move |
| 24 |
|
|
MARK_KO # this is a ko position |
| 25 |
|
|
MARK_REDRAW # ignored, can be used for your own purposes |
| 26 |
|
|
|
| 27 |
|
|
COLOUR_BLACK # used for $board->{last} |
| 28 |
|
|
COLOUR_WHITE # to mark the colour of the last move |
| 29 |
|
|
|
| 30 |
|
|
METHODS |
| 31 |
|
|
my $board = new $size |
| 32 |
|
|
Creates a new empty board of the given size. |
| 33 |
|
|
|
| 34 |
|
|
"$board->{max}" stores the maximum board coordinate (size-1). |
| 35 |
|
|
|
| 36 |
|
|
"$board->{captures}[COLOUR]" stores the number of captured stones |
| 37 |
|
|
for the given colour. |
| 38 |
|
|
|
| 39 |
|
|
"$board->{last}" stores the colour of the last move that was played. |
| 40 |
|
|
|
| 41 |
|
|
"$board->{board}" stores a two-dimensional array with board |
| 42 |
|
|
contents. |
| 43 |
|
|
|
| 44 |
|
|
$hint = $board->update ([update-structure...]) |
| 45 |
|
|
Structure is |
| 46 |
|
|
|
| 47 |
|
|
[$x, $y, $clr, $set, $label, $hint] # update or move |
| 48 |
|
|
[] # pass |
| 49 |
|
|
|
| 50 |
|
|
and changes the board or executes a move, by first clearing the bits |
| 51 |
|
|
specified in $clr, then setting bits specified in $set. |
| 52 |
|
|
|
| 53 |
|
|
If $set includes "MARK_LABEL", the label text must be given in |
| 54 |
|
|
$label. |
| 55 |
|
|
|
| 56 |
|
|
This function modifies the hint member of the specified path to |
| 57 |
|
|
speed up repeated board generation and updates with the same update |
| 58 |
|
|
structures. |
| 59 |
|
|
|
| 60 |
|
|
If the hint member is a reference the scalar pointed to by the |
| 61 |
|
|
reference is updated instead. |
| 62 |
|
|
|
| 63 |
|
|
Example, make two silly moves: |
| 64 |
|
|
|
| 65 |
|
|
$board->update ([[0, 18, -1, MARK_B|MARK_MOVE], |
| 66 |
|
|
[0, 17, -1, MARK_W|MARK_MOVE]); |
| 67 |
|
|
|
| 68 |
|
|
$board->is_valid_move ($colour, $x, $y[, $may_suicide]) |
| 69 |
|
|
Returns true if the move of the given colour on the given |
| 70 |
|
|
coordinates is valid or not. |
| 71 |
|
|
|
| 72 |
|
|
AUTHOR |
| 73 |
|
|
Marc Lehmann <schmorp@schmorp.de> |
| 74 |
|
|
|
| 75 |
|
|
SEE ALSO |
| 76 |
|
|
KGS::Protocol, KGS::Game::Tree, Gtk2::GoBoard. |
| 77 |
|
|
|