StateNode
Classes
Constants
Functions
StateNode
Kind: global class
Author: Alex Goldring
Copyright: Company Named Limited (c) 2025
- StateNode
- .depth :
number - .wins :
number - .losses :
number - .playouts :
number - .heuristicValue :
number - .parent :
null|StateNode - .moves :
null|Array.<MoveEdge> - .type :
StateType - .aggregateHeuristicScore()
- .expand(state, computeValidMoves, computeTerminalFlag) ⇒
number - .addPlayouts(playouts, wins, losses)
- .isTerminal() ⇒
boolean - .isExpanded() ⇒
boolean - .pickBestMoves() ⇒
Array.<MoveEdge> - .traverse(visitor)
- .depth :
stateNode.depth : number
How deep is the node in the tree
Kind: instance property of StateNode
stateNode.wins : number
Kind: instance property of StateNode
stateNode.losses : number
Number of leses in the subtree of this state
Kind: instance property of StateNode
stateNode.playouts : number
total number of explored playouts
Kind: instance property of StateNode
stateNode.heuristicValue : number
Kind: instance property of StateNode
stateNode.parent : null | StateNode
parent node, previous state
Kind: instance property of StateNode
stateNode.moves : null | Array.<MoveEdge>
Kind: instance property of StateNode
stateNode.type : StateType
Kind: instance property of StateNode
stateNode.aggregateHeuristicScore()
Aggregate heuristic score from children
Kind: instance method of StateNode
stateNode.expand(state, computeValidMoves, computeTerminalFlag) ⇒ number
Kind: instance method of StateNode
Returns: number - number of children
| Param | Type |
|---|---|
| state | |
| computeValidMoves | function |
| computeTerminalFlag |
stateNode.addPlayouts(playouts, wins, losses)
Kind: instance method of StateNode
| Param | Type |
|---|---|
| playouts | number |
| wins | number |
| losses | number |
stateNode.isTerminal() ⇒ boolean
Whenever this is a terminal state or not (win/loss)
Kind: instance method of StateNode
stateNode.isExpanded() ⇒ boolean
Kind: instance method of StateNode
stateNode.pickBestMoves() ⇒ Array.<MoveEdge>
Kind: instance method of StateNode
stateNode.traverse(visitor)
Kind: instance method of StateNode
| Param | Type |
|---|---|
| visitor | function |
StateType : enum
Kind: global enum
stack : Array.<StateNode>
Kind: global constant
computeScore(move, totalPlayouts, totalUncertainPlayouts) ⇒ number
Kind: global function
| Param | Type |
|---|---|
| move | MoveEdge |
| totalPlayouts | number |
| totalUncertainPlayouts | number |
computeScore~stateNode : StateNode
Kind: inner constant of computeScore