Konstas.Engineering Notes
Networking · Cybersecurity · Infrastructure
Probability & Simulation

The Solitaire Solution: Stanisław Ulam and the Genesis of Monte Carlo Simulation

Data Science Series · August 2026 · Ioannis (John) Konstas

How a recovering mathematician's hospital card game became the Monte Carlo Method — and why the gamblers of 1913 lost everything to the same probability they refused to understand.

Probability  ·  Stochastic Simulation  ·  History of Computing  ·  Ioannis (John) Alexander Konstas

Monte Carlo Method Stanisław Ulam John von Neumann ENIAC Probability Gambler's Fallacy Stochastic Simulation Nuclear Physics
🃏 A Mind in Recovery
§1

The hum of the hospital ward in 1946 felt like a heavy shroud to Stanisław Ulam. Just days prior, surgeons had cut into his skull to save his life from a raging case of viral encephalitis. Now, the agonizing headaches were fading, but a deeper terror remained. Was his mind gone? Were the numbers lost?

To test his fractured thoughts, Stanisław picked up a deck of cards. Weakly, he began dealing them out onto his bedside table, playing game after game of solitaire.

As a world-class mathematician, his instinct immediately kicked in. He didn't just want to play; he wanted to solve the game. He wanted to use the classic combinations formula to calculate the exact mathematical probability of a random layout resulting in a win:

$$C(n,\,k) \;=\; \frac{n!}{k!\,(n-k)!}$$

But the math was a chaotic beast. Shifting piles, hidden cards, and a staggering $52!$ (52 factorial) permutations made an exact algebraic formula impossible to write on paper. His brain, still healing, throbbed with frustration.

Then, a spark of pure, unconventional genius struck him.

"Why am I trying to calculate it? Why not just play it a hundred times, count the wins, and see what happens?"

He realized that instead of fighting for an abstract formula, he could use pure, data-driven trial and error. But a human could only deal cards so fast. He needed a machine that could play a million random games in the blink of an eye.

⚡ From Cards to Neutrons
§2

As soon as he was discharged, Stanisław shared his epiphany with his brilliant friend, John von Neumann. Von Neumann's eyes lit up. He had access to the ENIAC — the world's very first electronic computer. They didn't use the computer for cards; instead, they realized Ulam's solitaire simulation could solve the world's most dangerous physics problems, like tracking how random neutrons collided in nuclear reactions.

Solitaire Simulation 52! permutations → sample randomly Ulam's insight ENIAC 1,000,000 trials per second von Neumann Nuclear Physics neutron collisions → Monte Carlo Method A bedside card game → the foundation of modern computational simulation

Because the entire method relied on the laws of pure, random chance, it needed a code name. They looked back in history to the ultimate temple of randomness: the grand casino of Monaco. They officially dubbed it the Monte Carlo Method — a subtle nod to Ulam's uncle, who loved to gamble away his money there.

🎰 The Casino That Named the Method
§3

The name was poetically perfect, because decades earlier, that exact same casino had borne witness to the world's most catastrophic misunderstanding of randomness and probability.

On August 18, 1913, a crowd gathered around a roulette wheel at the Casino de Monte-Carlo. The ball clattered around the rim and landed on black. Then it landed on black again. And again. By the time the streak hit 15 consecutive blacks, a near-panicky rush of excitement swept the casino floor.

Roulette wheel — the symbol of the Monte Carlo Fallacy

Casino de Monte-Carlo roulette — where 26 consecutive blacks shattered fortunes and birthed a fallacy.

The gamblers fell victim to a psychological trap known as the Gambler's Fallacy (sometimes called the Monte Carlo Fallacy). It is the irrational belief that if an event happens frequently over a short period, it becomes less likely to happen in the future — as if the universe has a cosmic memory and forces a balance.

"Red is overdue!" the players reasoned. They doubled and tripled their stakes, dumping millions of francs onto red, absolutely convinced that the laws of probability guaranteed a correction.

But a roulette wheel has no memory. The ball has no brain. Every single spin is a perfectly independent event with a static, unyielding ~50/50 chance. The wheel didn't care what the gamblers believed.

Consecutive blacks Probability (approx.) What the gamblers thought
5 in a row1 in 32Unusual — maybe double the bet
10 in a row1 in 1,024"Red is definitely next"
15 in a row1 in 32,768All-in on red
26 in a row~1 in 66,000,000Millions of francs lost

The ball landed on black an astonishing 26 times in a row. The odds of that happening by pure chance were roughly 1 in 66 million. Before the streak finally ended on red on the 27th spin, clueless gamblers had lost the modern equivalent of millions of dollars betting against a streak because they didn't understand how independent probability worked.

🎯 What Ulam Understood That They Didn't
§4

Where the ruined gamblers of 1913 saw a mystical pattern that owed them a win, Stanisław Ulam saw the truth. Sitting in his recovery bed years later, dealing simple cards to prove his mind wasn't broken, he embraced the cold, mathematical reality of random chance.

He realized that while individual random trials are entirely unpredictable, simulating millions of them exposes the immutable truth of the universe. The key insight that separates the Monte Carlo Method from gambling:

The GamblersUlam's Method
View of randomness Memory — past events constrain the future Independence — each trial is fresh
Sample size Tiny (one streak = "proof") Massive (millions of trials)
Goal Beat the wheel Estimate the true distribution
Result Systematic ruin Foundation of modern simulation

He hadn't just saved his own sanity — he had turned the very chaos that broke the gamblers of Monte Carlo into the foundation of modern computer simulation. Today, Monte Carlo methods underpin climate models, financial risk engines, pharmaceutical trials, particle physics, and every major machine learning framework's hyperparameter search.

The next time you run a random seed in Python, you are thinking the way Ulam thought — not the way the gamblers did.

← Back to Data Science

Research and direction by Ioannis (John) Konstas; compiled and finalized with AI assistance.

👁· views