Saturday, 31 May 2014

The Monty Hall Problem



I've made a simulation of the Monty Hall Problem! The problem is as follows:

  • There are 3 doors, 1 has a luxury good behind it, eg. fancy car, the other two have worthless things. The incentive is to guess the door which has the car behind it.
  • You select a door, another door that does not have the car behind it is opened
  • You are given the option to switch doors, or stick with your choice
According to the following video, if you stick with your original choice, that will provide a probability of 1/3 that the car was behind it, but if you switched to the only remaining door, there would be a probability of 2/3 that it would be behind that one.

I've made it so you can run multiple games and find out the percentage win rate. Through my own testing of the simulation, the theory saying that you should switch definitely has merit. If I was asked, I would definitely switch.



Code/Edit



Also comes with CSS hover animations~

No comments:

Post a Comment