Class Node<GS, M, D>

Representation of a node in the game Tree.

Holds the gamestate, a list of moves and a list of child nodes.

Type Parameters

  • GS

    The object representing the state of the game

  • M

    The object representing a move in the game

  • D

    Extra data used in evaluation not suitable for storing in the gamestate

Hierarchy

  • Node

Constructors

  • Type Parameters

    • GS

    • M

    • D

    Parameters

    • type: NodeType

      Defines location within tree. See NodeType.

    • gamestate: GS

      Gamestate used to create the node. Should be a clone of that used in the actual game.

    • move: M

      Move used to reach this node. For root node, use a Null version of the correct data type.

    • data: D

      Extra data accessible by the evaluation function. If not used, set to 0.

    • aim: NodeAim = NodeAim.NONE

      Defines how best child node is selected.

    • moves: M[] = []

      Reference to all the possible moves from this node.

    Returns Node<GS, M, D>

Properties

parent: undefined | Node<GS, M, D>

parent of this node, undefined if node is root

children: Node<GS, M, D>[] = []

List of the child nodes that link to this node

moveInd: number = 0

Index of next move to be branched

value: number = NaN

Value of the gamestate at this node

inheritedValue: number = NaN

Value used for selection by parent of this node

inheritedDepth: number = -1

Search depth when inherited value was assigned Use to remove false selections when a-b pruning

pathLength: number = 1

Minimum number of moves required until a leaf node is reached.

scores: number[] = []

Scores used for multiplayer minimax

inheritedScores: number[] = []

scores inherited from best child

activePlayer: number = 0

Player to play turn from this node

child: undefined | Node<GS, M, D>

Best child as selected by aim

pruned: boolean = false

true if any children of node have been pruned, false if full search

descendantCount: number = 0

Count of decendant nodes

type: NodeType

Defines location within tree. See NodeType.

gamestate: GS

Gamestate used to create the node. Should be a clone of that used in the actual game.

move: M

Move used to reach this node. For root node, use a Null version of the correct data type.

data: D

Extra data accessible by the evaluation function. If not used, set to 0.

aim: NodeAim = NodeAim.NONE

Defines how best child node is selected.

moves: M[] = []

Reference to all the possible moves from this node.

Generated using TypeDoc