Skip to content

MctsOptions

Defined in: src/modules/game-search/mcts.ts:11

Options for mctsSearch. With neither iterations nor timeMs it runs 1 000 iterations.

S

M

P = number

optional evaluate?: (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.

S

P

number


optional exploration?: number

Defined in: src/modules/game-search/mcts.ts:13

The UCT constant: higher tries less-visited moves more. Default Math.SQRT2.


optional iterations?: 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.


optional maxRolloutDepth?: number

Defined in: src/modules/game-search/mcts.ts:17

Moves a random playout may make before it is cut short. Default 1 000.


optional now?: () => number

Defined in: src/modules/game-search/mcts.ts:28

Clock for timeMs, in milliseconds. Default performance.now.

number


optional random?: RandomFn

Defined in: src/modules/game-search/mcts.ts:19

Source of randomness; pass a seeded one for repeatable play. Default Math.random.


optional rollout?: (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.

S

RandomFn

M


optional timeMs?: number

Defined in: src/modules/game-search/mcts.ts:21

Stop after about this many milliseconds, or after iterations, whichever comes first.