Skip to main content
pcloadletter

The Monty Hall Problem, a side-by-side simulation

I saw a cool version of the Monty Hall game here recently: https://monty.donk.systems.

This is really cool! But I had an itch I wanted to scratch: rather than manually test out the probabilities, I wanted to run two games side-by-side: one where a switch happened and one where a switch didn't happen. Then, running those over and over, we should see the overall win percentages converge to 66.7% for switching and 33.3% for not switching.

So I coded up a simulation here to scratch my itch!

Controls #

To control the simulation, you can start or stop here. You can also adjust the speed.

Score #

Cumulative stats as the games go on.

Scenario Plays Wins Win Percent
Switch 0 0 -
No switch 0 0 -

Switch simulation #

If we switch cards after the first goat reveal.

                 
+---+  +---+  +---+
|   |  |   |  |   |
+---+  +---+  +---+

No switch simulation #

If we don't switch.

                 
+---+  +---+  +---+
|   |  |   |  |   |
+---+  +---+  +---+
Enjoy this post? Please subscribe to my RSS feed on Feedly or add my RSS XML file to another reader!