Monty Hall Simulator

Simulate stay and switch strategies under the classic host-knows Monty Hall rules.

At a glance

Computes
Win rates for staying and switching over repeated games, against the exact probabilities.
You supply
Number of doors, trials per run, animation speed, and a random seed.
Use when
You need the switching advantage demonstrated rather than asserted.
Assumes
The host always knows where the prize is and always opens a losing door.

The host knows where the prize is and opens only goat doors.

Speed changes presentation only, not the simulated results.

Use the same seed to replay the same run.

Stay win rate

Not run

Switch win rate

Not run

Exact stay probability
33.3%
Exact switch probability
66.7%
Trials completed
Not run

Exact probabilities stay fixed; simulation varies by seed.

Run the simulation to fill Monte Carlo metrics and convergence.

Win rate against Trial; reference at Exact switch probability

0204060801000.00.20.40.60.81.0Exact switch probabilityStay rateSwitch rate
Convergence checkpoints
TrialStay winsStay rateSwitch winsSwitch rate
Export

P(stay) = 1 / doors; P(switch) = (doors - 1) / doors How?

How this is calculated

The simulator uses the standard host-knows rule set: the prize is placed uniformly, the contestant chooses uniformly, the host opens losing unchosen doors, and switching wins exactly when the initial choice was wrong.

Formula: P(stay) = 1 / doors; P(switch) = (doors - 1) / doors

Sources

  1. Wolfram MathWorld Monty Hall Problem. Wolfram MathWorld. Retrieved .
  2. Monty Hall problem bibliography. Wikipedia. Retrieved .

Method last reviewed