The Monty Hall Simulation

The last resort in a stalled discussion about the "Goat Problem" is usually not the mathematical proof (although one would expect that), but the offer to write a computer program that simluates the game, run it a thousand times, and just look at the result.

Of course that's a dangerous way to go because after all, it's all random, and that means that there is the possibility that the program will return misleading results even after a thousand simluation runs. (In fact, computer programs cannot really generate random numbers, it's just "pseudo-random", but four our purposes it should be enough.)

The Java applet on this page requires a browser capable of running Java 1.1 (like Netscape Navigator 4.04+, or browsers using a Java plugin, or just load this page in Sun's appletviewer). Using this applet, you can simulate single games or let the program run in a continuous mode and watch how the result develops.

Your browser doesn't display the applet. Maybe Java is disabled?

The applet shows that while the overall probability of success for a candidate who decides randomly is 50%, more victories take place after the candidate has switched. So if he would not decide randomly but always switch, his overall probability of success would increase to 66%.

Of course I can tell you anything - maybe I fixed the program to give exactly the results I wanted it to give! So if you are skeptical, just download the source and see for yourself!

If that is not sufficient for you, there's still

Back to the problem description

  Frederik Ramm, 2003-02-08