Monty Hall Problem
A colleague of mine gave me the following puzzle to solve, which is the famous Monty Hall problem:
Suppose you’re on a game show, and you’re given the choice of three doors. Behind one door is a car, behind the others, goats. You pick a door, say number 1, and the host, who knows what’s behind the doors, opens another door, say number 3, which has a goat. He says to you, “Do you want to pick door number 2?” Is it to your advantage to switch your choice of doors?
In the evening I wrote a simple console application that proves the solution practically running the game 10000 times.
The application shows you validation of the .NET random engine first. There are percentages of 0, 1, 2 numbers received from the Random class executed for 10000 times. Then it shows percentage of success when you “pick door number 2” (switching your choice) and percentage of success when you stay with your first selected door.
The success rate is 2/3 when the door is switched and 1/3 for the runs that stick. There is only one cs file on GitHub. You can compile it in Visual Studio command line “csc.exe GoatSelector.cs” and execute GoatSelector.exe.
2 Comments »
Leave a comment
-
Recent
- OpenGL hardware acceleration through remote X11 SSH connection
- GDB: How do I set current source file for list and break commands
- How To Create and Seed a Torrent (Ubuntu server, Transmission)
- GIT TF: Undo shallow pull and pull squashed changeset
- Lynx on Windows 7 and lynx_bookmarks.html file problem
- Old MacBook Overheating and Installation of Mac OS 10.4 on New Hard Drives
- Memory Alignment Of Structures and Classes in C++
- Align label and input vertically
- Google Test Framework and Visual Studio 2010
- Convex Hull
- Run a bash script with sudo, nohup and in the background
- Contact database with web interface – EVPO Members
-
Links
-
Archives
- March 2017 (1)
- May 2015 (1)
- January 2015 (1)
- November 2014 (1)
- October 2014 (1)
- March 2014 (1)
- January 2014 (1)
- June 2013 (1)
- May 2013 (2)
- February 2012 (2)
- October 2010 (1)
- February 2010 (1)
-
Categories
-
RSS
Entries RSS
Comments RSS
Hey Evgeny,
I’ve run into this problem before, it’s call the Monty Hall Problem. That’s pretty cool that you’ve made a program for it though!
http://en.wikipedia.org/wiki/Monty_Hall_problem
Comment by Rory | March 6, 2013 |
Rory, I wrote this program because I couldn’t believe the statistical results. They were not intuitive for me. I wanted to see if they were really correct and they were. I respected statistics more then ever after this.
Comment by evpo | March 6, 2013 |