Description Usage Arguments Details Value See Also
gogame
class object capusulizes a go game record.
It keeps stores such game plays, outcomes as well as
other information such as player names and date.
The object supports various methods for creating board images and
Kifu documents.
1 | gogame(properties, gametree)
|
properties |
a list of game properties |
gametree |
a list |
This is a constructor of gogame
class object.
It is mainly designed to be called from parse_sgf
function,
which interprets text of sgf format and creates the corresponding
gogame
object.
The object can produce two kinds of game images.
The first is a board snapshot at an arbitrary timing.
stateat
is for computing the board configuration and
plotat
is for drawing the board image.
The second kind of images is the kifu document that summarize a range of
moves in a page.
kifu
is prepared for computing the move sequence and
kifuplot
is for drawing the image.
The constructor takes two mandatory arguments: properties
and gametree
.
properties
is a named list of game meta information.
Currently, following names are recognized (variable type in parentheses).
One may provide additional information so long as it does not contradict
names of other information. Check str(mimiaka)
to see a list of
variable names already in use.
boardsize
board size (integer
whitename
, whiterank
, blackname
, blackrank
player
names and ranks (character
)
komi
Komi (numeric
)
handicap
number of handicap stones (integer
)
result
game outcome (character
)
date
, place
game date and location (character
)
event
, round
competition or event name and round (character
)
rule
rule (character
)
gametree
stores game plays, setups, comments, and territory counts.
To accomodate the cases of games with branches, the object employs a tree
data structure.
gametree
should contain potentially four data sets.
Parentheses list the variable names to be contained.
transition
Transition of board configuration.
a positive value means a stone is added, negative means removed.
Absolute values of value indicate the stone color (1: black, 2: white)
(x
, y
, value
, move
, nodeid
)
move
Moves and setups. ismove
indicates whether it is a
move or setup (x
, y
, color
, ismove
, move
, nodeid
)
point
Territories.
(x
, y
, color
, move
, nodeid
)
comment
Comments made during the game.
(comment
, move
, nodeid
)
nodeid
variable in each data indicates the tree node to which the row belongs to.
gametree
also include three variables that describe tree structure.
parent
integer vector that points parent of each node. The first node is always assumed to be the root node and its parent is zero
children
list of integer vector that points children of each node
leaf
integer vector of leaf nodes (i.e. no children)
For example, when there is only one node, nodeid
variable of all data should be 1,
and parent
is 0 (there is only the root node), children
has unique entry
and it is integer vector of length zero, and leaf
is 1.
When some of the three components are missing, then the function tries the best to
recover from the supplied information
When transition
is missing, then the function tries to compute it using
move
and tree structure information.
gogame
object
read_sgf
, parse_sgf
,
plotat
, stateat
, kifu
, kifuplot
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.