Node Class |
Namespace: VikingChess.Model
internal class Node
The Node type exposes the following members.
Name | Description | |
---|---|---|
Node(Board) |
Constructs a new Node. This constructor is used to form the root of the Node tree.
| |
Node(Node) |
Copy Constructor
| |
Node(Board, Node) |
Constructs a new Node. This constructor is used to create a child Node.
|
Name | Description | |
---|---|---|
AddChild |
Adds a new child Node to this Node.
| |
Equals | (Inherited from Object.) | |
ExpandNode |
Expands this Node by creating new child Node | |
Finalize | (Inherited from Object.) | |
getBestChild |
Finds the best child Node of this Node | |
GetBoard |
Returns the Board object contained in this Node.
| |
GetChildren |
Returns the children of this Node.
| |
GetHashCode | (Inherited from Object.) | |
GetLastMove |
Returns the lastMoveTuple of this Node | |
GetParent |
Returns the parent of this Node.
| |
GetScore |
Returns the score of this Node.
| |
GetType | (Inherited from Object.) | |
GetVisits |
Returns the number of times this Node has been visited.
| |
getWin |
Returns the win status of this Node | |
getWinChance |
Returns the chance that this Node will lead to a win.
| |
isLeaf |
Checks to see if this is a leaf Node.
| |
MemberwiseClone | (Inherited from Object.) | |
setLastMove |
Sets the lastMoveTuple of this Node.
| |
setWin |
Sets the win status of this Node | |
ToString | ToString override
(Overrides ObjectToString.) | |
UCTSelectBest |
Uses the UCT formula to select the most promising child Node to explore.
// UCT Formula uctVal = (child.GetScore() / (child.GetVisits() + EPSILON)) + Math.Sqrt(2) * Math.Sqrt((Math.Log(GetVisits() + 1)) / (child.GetVisits() + EPSILON)) + x + EPSILON; | |
updateScore |
Updates the score of this Node.
| |
updateStats | ||
updateVisitCount |
Updates the visitCount of this Node |
Name | Description | |
---|---|---|
board |
The Board object representing the game board and position of pieces.
| |
children |
An [!:List] containing any and all child [!:States] of this Node | |
EPSILON |
A constant to protect against divide by zero errors in the UCT algorithm.
| |
hasWon |
Defines whether or not the board contained within this node is a terminal state or not.
| |
lastMoveTuple |
The last move made that resulted in the board of this node.
| |
parent |
The parent Node of this Node | |
score |
The score of this Node | |
visitCount |
The number of times this Node has been visited.
|