Monty Hall

Back to projects list

HTML UI

Image by Cepheus - Own work, Public Domain

The Monty Hall problem, named after the host of the game show “Let's Make a Deal” is a probability problem famous for confunding the intuitions of even people (like math professors) who should know better.

The premise of the problem is that your are a contestant on a game show who has to choose from one of three doors. A valuable prize (such as a car) is hidden behind one of the three doors and behind the other two a less desirable prize such as nothing or (traditionally) a goat. After you make your choice, the host opens one of the doors you did not choose to reveal that the valuable prize was not behind that door. The host then offers you the chance switch from your original choice to the remaining door.

The question is, should you? If you don’t already know about this problem, take a moment to think what you would do and why.

In this project you will build a simple web page that lets you play the game with the computer acting as the game show host. It should show you three doors, let you pick one, then “open” one of the other doors, picking one that does not hide the valuable prize. Then you should make your final choice—either switching to the remaining door or staying with your original choice—and the page should let you know if you won the valuable prize or not.

Once you’ve got that working, you should add something to the page where you keep track of how many times you played, how many times you switched doors and how many times you didn’t, and the percentage times you won when you switched and when you didn’t.

As a final step, if you get to it, take the human out of the loop and have the computer play repeatedly, sometimes switching and sometimes not, and track how it does under each regime.

References