Class: Record

Record

new Record(width, height)

Create a go game record that can handle plays and variations. A Board object is created that will reflect the current position in game record.
Parameters:
Name Type Description
width int Board width.
height int Board height.
Source:

Methods

createNode(clearParentMarks, info) → {Node}

Create new empty node under current one.
Parameters:
Name Type Description
clearParentMarks bool True to clear parent node marks.
info Object Node information - ko coordinate, comment, etc.
Source:
Returns:
New, current node.
Type
Node

createSnapshot()

Create a snapshot of current Record state. Will contain board state and current node.
Source:
Returns:
Snapshot to be used with restoreSnapshot().

first() → {Node}

Go to the beginning of the game tree.
Source:
Returns:
New current node.
Type
Node

getBoard() → {Board}

Get board object.
Source:
Returns:
Board object.
Type
Board

getCurrentNode() → {Node}

Get current node.
Source:
Returns:
Current node.
Type
Node

getRootNode() → {Node}

Get root node.
Source:
Returns:
Root node.
Type
Node

getVariation() → {int}

Get current variation number (zero-based).
Source:
Returns:
Current variations.
Type
int

getVariations() → {int}

Get number of variations for current node.
Source:
Returns:
Number of variations.
Type
int

next(variationopt) → {Node}

Advance to the next node in the game tree.
Parameters:
Name Type Attributes Description
variation int <optional>
parameter to specify which variation to select, if there are several branches.
Source:
Returns:
New current node or null if at the end of game tree.
Type
Node

normalize(node)

Normalize record so the longest variation is the first.
Parameters:
Name Type Description
node Node The node to start with. Defaults to root if unset.
Source:
Returns:
int Length of longest subsequence.

previous() → {Node}

Back up a node in the game tree.
Source:
Returns:
New current node or null if at the beginning of game tree.
Type
Node

restoreSnapshot(raw)

Restore the Record to the state contained in snapshot. Use only if you REALLY know what you are doing, this is mainly for creating Record quickly from SGF.
Parameters:
Name Type Description
raw Object Snapshot created with createSnapshot().
Source:

setVariation(variationopt)

Go to a variation. Uses previous() and next().
Parameters:
Name Type Attributes Description
variation int <optional>
parameter to specify which variation to select, if there are several branches.
Source: