MctsOptions
Defined in: src/modules/game-search/mcts.ts:11
Options for mctsSearch. With neither iterations nor timeMs it runs 1 000 iterations.
Type Parameters
Section titled “Type Parameters”S
M
P = number
Properties
Section titled “Properties”evaluate?
Section titled “evaluate?”
optionalevaluate?: (state,player) =>number
Defined in: src/modules/game-search/mcts.ts:26
Scores a playout that was cut at maxRolloutDepth from player’s side, from
-1 (loss) to 1 (win); results outside that range are clamped. Default: a draw.
Parameters
Section titled “Parameters”S
player
Section titled “player”P
Returns
Section titled “Returns”number
exploration?
Section titled “exploration?”
optionalexploration?:number
Defined in: src/modules/game-search/mcts.ts:13
The UCT constant: higher tries less-visited moves more. Default Math.SQRT2.
iterations?
Section titled “iterations?”
optionaliterations?:number
Defined in: src/modules/game-search/mcts.ts:15
Iterations to run; at least one always runs. Default 1 000 without timeMs, unlimited with it.
maxRolloutDepth?
Section titled “maxRolloutDepth?”
optionalmaxRolloutDepth?:number
Defined in: src/modules/game-search/mcts.ts:17
Moves a random playout may make before it is cut short. Default 1 000.
optionalnow?: () =>number
Defined in: src/modules/game-search/mcts.ts:28
Clock for timeMs, in milliseconds. Default performance.now.
Returns
Section titled “Returns”number
random?
Section titled “random?”
optionalrandom?:RandomFn
Defined in: src/modules/game-search/mcts.ts:19
Source of randomness; pass a seeded one for repeatable play. Default Math.random.
rollout?
Section titled “rollout?”
optionalrollout?: (state,random) =>M
Defined in: src/modules/game-search/mcts.ts:34
Picks the move a playout plays in state, which has at least one legal move.
Default: a uniformly random legal move. A smarter policy (take a win, avoid
a blunder) makes each playout more informative.
Parameters
Section titled “Parameters”S
random
Section titled “random”Returns
Section titled “Returns”M
timeMs?
Section titled “timeMs?”
optionaltimeMs?:number
Defined in: src/modules/game-search/mcts.ts:21
Stop after about this many milliseconds, or after iterations, whichever comes first.