Had too much time between my flights at Frankfurt, and the old “Find and Win the Elephant/Car Behind 3 Doors” (Monty Hall problem) puzzle is easily the simplest psychology/probability/Math puzzle that bothers people. The puzzle, commonly stated is as follows:

You are a contestant on a game show, where the prize is a Mercedes Benz. You are shown 3 unmarked doors, one of which is the door to the Benz and the other 2 doors lead to nothing (or goats). You can pick a door, and if you pick the right door, you can drive away with a new Benz. Most of us can quickly agree that the probability of winning the Benz is 1/3. (The interesting variation comes next.)

The setup is the same – you are still a contestant, trying to win the Benz, and there are still 3 unmarked doors. However, in this case, the game show host, who knows the door that has the car, is trying to help you. When you pick a door, the game show host flings open one of the two doors that you did not select, and that door (as you can observe after he flings it open) does NOT lead to the car. Then, he gives you a chance to reevaluate your choice – you can keep the door that you originally selected, or to switch to the other unopened door.

The question is: Should you switch?

The subtext here is that door that you selected, has the probability of being the right door of 1/3, and of not being the right door of 2/3. If you did not select the right door initially, when you switch, you will have the right door. If you selected the right door initially, when you switch, you will have a wrong door. So, if you do switch, the probability of you getting to the right door becomes 2/3, and there is a probability of 1/3 that you leave your good door and go to a wrong door. You can choose to look at it very many different ways, and come up with many good arguments, and you can convince yourself one way or the other.

There are many answers to this problem, and one of which, which happens to be the CORRECT one is, that Yes, you should ALWAYS switch. The probability of you winning the Benz if you switch, is indeed 2/3. The probability of you winning the Benz, if you do not switch remains a rather uninteresting 1/3.

If you have had enough of the arguments, you can look at this simple Monte Carlo simulation, and observe the results yourself. Of course, no reason to trust the results without looking at the code, so please feel free to download the source code here. The simulation models two contestants – contestant 1 who always switches, and contestant 2 who never switches and sticks with the original choice.

>>> =================== RESTART ======================

Total number of times run: 100000

Win count when switching the choice: 66613

Win count when not switching the choice: 33267

>>> =================== RESTART ======================

Total number of times run: 1000000

Win count when switching the choice: 666085

Win count when not switching the choice: 333498

>>> =================== RESTART ======================

Total number of times run: 10000000

Win count when switching the choice: 6665600

Win count when not switching the choice: 3329991

It is a Monte Carlo simulation, so you can run it, and you can observe different results each time due to randomization. I do not have Python experience, so I used Python in this example so I could learn it a bit as well. If you have a different programming language that you think I should keep in mind for some other simulation, let me know.