Ismcts

class Ismcts<State, Move, View, Actor>(rules: GameRules<State, Move, Actor, View>, rolloutPolicy: () -> Policy<View, Move>, staticEval: (State, Actor) -> Double, budget: SearchBudget)

Generic Information-Set Monte Carlo Tree Search shell. Knows nothing about any specific game — every domain concept (rules, leaf evaluation, rollout policy) is injected by the caller.

Determinization (sampling a consistent full State from a hidden-information View) is deliberately OUT of scope here: search's determinize parameter is called once per iteration to supply that fresh determinized root, since HOW hidden information is sampled (belief models, priors, ...) is domain-specific and stays out of this shell.

rolloutPolicy is a FACTORY, not a single instance, and is invoked once per rollout ply. This is load-bearing for callers that reseed a fresh policy per ply (e.g. from a dedicated RNG stream) — a single shared, continuously-advancing rollout policy instance can measurably weaken deeper searches versus per-ply reseeding. Keeping it a factory lets a caller reproduce exact seeding while this shell stays domain-agnostic (the factory closes over the caller's own RNG; the shell never sees a seed).

Constructors

Link copied to clipboard
constructor(rules: GameRules<State, Move, Actor, View>, rolloutPolicy: () -> Policy<View, Move>, staticEval: (State, Actor) -> Double, budget: SearchBudget)

Functions

Link copied to clipboard
fun search(determinize: () -> State, legal: List<Move>, viewer: Actor, rolloutHorizon: Int, elapsedMillis: () -> Long): SearchNode<Move>

Runs the search and returns the populated root node (one child per element of legal, plus whatever the tree expanded into). determinize supplies one fresh determinized State per iteration; a thrown exception from it is treated as a free retry (does not consume an iteration) — the caller is expected to advance its own RNG before rethrowing, mirroring a failed-sample retry. elapsedMillis is polled against SearchBudget.maxMillis.