Monte Carlo
Meteors rain on a starfield to estimate pi, areas and curves, with racing sampler bots and a live bell curve.
call it
Will the estimate stay inside the 95% band for the next 1,000 meteors?
The numbers
Many runs
200 experiments at once
sampler bots race
More experiments
Monte Carlo for decisions
Monte Carlo tree search
Random games can pick a move as well as measure an area. Each playout walks down a growing tree of moves, choosing by UCB1, finishes the game at random and counts who won. Good moves collect wins, so they get played more; the bonus term keeps the others from being forgotten.
How it works
Throw meteors at a square without aiming. The share that lands inside the circle matches the share of the square the circle covers, which is pi / 4 when the circle just fits. Count, multiply by four, and pi falls out of pure chance.
The law of large numbers says the average of many random tries settles on the true value. It settles slowly: the typical error shrinks like 1 / √n, so a hundred times the meteors buys one more correct digit. That is the band on the chart, and why 200 runs at once pile up into a bell curve that narrows as n grows.
Smarter sampling helps. Stratified bots spread their throws over a grid, and Halton points fill gaps on purpose, so their error falls faster. The same trick prices options, renders film lighting, runs weather and nuclear physics models, and plans spacecraft routes when the exact answer is too hard to work out.
Monte Carlo also makes decisions. Tree search plays random games from a position, keeps score for each move and uses UCB1 to spend more playouts on the promising ones, so the same law of large numbers that finds pi finds a good move. Game programs from Go to Connect Four use it.
Randomness, used enough times, turns into certainty.