Interactive Lab · Search & Planning
Monte-Carlo Tree Search was never taught a single rule of tic-tac-toe beyond "here are the legal moves." To choose, it plays out thousands of random games in its head from each option and counts which one wins most often, then plays that. Slide the simulations up and watch a hopeless random flailer turn unbeatable. It's the exact idea (scaled up with a neural net) behind AlphaGo.
▶ The playground, you're X, beat the search
Monte-Carlo Tree Search is how an agent plans by imagining many futures before committing to a move. It's the search half of AlphaGo/AlphaZero and powers game AI, planning, and, increasingly, LLM “reasoning” (search over chains of thought). Use it when you can simulate outcomes and need to look ahead.
The code that's actually running
Drop the simulations to 10 and start a new game. Now MCTS barely gets to imagine anything, so it often misses an obvious block or win, you can beat it easily. Crank it to 2000 and try again: it will always block your threats and take any winning move, so the best you can get is a draw. Same code, same random rollouts, the only thing that changed is how many games it got to imagine. That's the whole bet of MCTS: thinking time buys strength.
The takeaway