🌳 MCTS Visualiser

Watch Monte-Carlo Tree Search grow a tree from a Connect-4 position — one node per simulation. Set up a board, run the search, then step / scrub through it.

1 · set up the root position

to move:
⚠ board edited — search tree is stale; press ▶ run MCTS to regenerate

2 · run the search

When ticked, playback walks down the tree one edge at a time, expands, rolls out, then walks back up updating one node at a time. Many more frames — use few sims (e.g. 10–20).

No neural net here: the prior is uniform and a leaf's value is the average of rollouts random playouts to the end of the game (classic MCTS; more rollouts = lower-variance value estimate). The four phases — select (follow PUCT), expand (add a child), simulate (rollout), back-up (negamax) — run once per simulation.

playback

node added this step this simulation's path / current node red to move yellow to move edge width ∝ visits · node tint = value for the player to move
node key: top = column played, then (N, Q)N = visit count, Q = mean value in [−1,+1] (parent's POV). Click a node for full per-move stats.

search tree

tree policy π(a) = N(s,a) / Σa N(s,a) — the root's visit distribution (green = chosen move)