Trees of nodes with properties. More...
#include <string>
#include "SgProp.h"
#include "SgPointSet.h"
#include "SgVector.h"
Go to the source code of this file.
Classes | |
class | SgNode |
Node in tree. More... | |
class | SgSonNodeIterator |
Iterator for iterating through all the sons of a SgNode. More... | |
class | SgSonNodeConstIterator |
Iterator for iterating through all the sons of a Node. More... | |
class | SgNodeIterator |
Iterator for iterating through all nodes in subtree. More... | |
class | SgNodeConstIterator |
Iterator for iterating through all nodes in subtree. More... |
Trees of nodes with properties.
Module SgNode defines trees and operations on those trees. The abstract data type 'Node' represents a node in a tree; each node has a list of properties associated with it. Typical properties are moves, territory, values, and comments.
Each node in the tree corresponds to a board position. The move leading to a position is stored in that node. The root node is the position where no move has as yet been played. Root nodes cannot have any brothers. There is no concept of "current position", as each node encodes both the tree it is in and its relation to other nodes in that tree. (The current position in the game is handled by GoGame.)
The special node pointer 0 has no father, no sons, no brother, and no properties. It is usually returned from procedures to indicate failure. Because the tree is usually traversed depth-first, it is safe to assume that it is faster to go to the leftmost than to the rightmost son, and faster to go to the right brother than to the left brother.
Definition in file SgNode.h.