MCTSNode

com.phasmidsoftware.gambit.game.MCTSNode
See theMCTSNode companion object
class MCTSNode[S, M, Pl](val state: S, val move: Option[M], val movedBy: Option[Pl], var visits: Int, var wins: Double, val children: ListBuffer[MCTSNode[S, M, Pl]], var untriedMoves: List[M])

A node in the MCTS search tree.

Mutable: visits and wins are updated in-place during backpropagation. Children are added during expansion. untriedMoves shrinks as children are expanded.

No parent reference -- backpropagation uses an explicit path stack accumulated during selection, avoiding circular references and the GC/equality issues that back-references cause in tree structures.

Type parameters

M

the move type.

Pl

the player identity type.

S

the state type.

Value parameters

children

expanded child nodes.

move

the move that led to this state (None for root).

movedBy

the player who made move (None for root).

state

the game state at this node.

untriedMoves

moves not yet expanded into children.

visits

number of times this node has been visited.

wins

cumulative score from simulations through this node, from the perspective of movedBy.

Attributes

Companion
object
Graph
Supertypes
class Object
trait Matchable
class Any

Members list

Value members

Concrete methods

def isFullyExpanded: Boolean

Determines if all possible moves from this node have been expanded into child nodes.

Determines if all possible moves from this node have been expanded into child nodes.

Attributes

Returns

true if there are no untried moves remaining for this node; false otherwise.

def isLeaf: Boolean

Determines if this node is a leaf node within the MCTS search tree (no children yet). A leaf node is characterized by having no child nodes.

Determines if this node is a leaf node within the MCTS search tree (no children yet). A leaf node is characterized by having no child nodes.

Attributes

Returns

true if this node has no children, indicating it is a leaf node; false otherwise.

override def toString: String

Returns a string representation of the object.

Returns a string representation of the object.

The default representation is platform dependent.

Attributes

Returns

a string representation of the object.

Definition Classes
Any

Concrete fields

val children: ListBuffer[MCTSNode[S, M, Pl]]
val move: Option[M]
val movedBy: Option[Pl]
val state: S
var untriedMoves: List[M]
var visits: Int
var wins: Double