Bob Metcalfe's recent column (Apr. 6, 1998) in Infoworld made me think
a little more about the Monty Hall Problem. Being one to question the
theory, I quickly assembled this program to run a simulation. The user
interface is rather rough, but workable. If you're a skeptic
of the theory, the results will surprise you.
Quickie instructions:
- Place a bet that the prize (Bob Metcalfe's new Volvo - Sorry Bob!)
is behind door number one, two, or three. Click a button under the door of
your choice. After you select a door,
another door is opened, revealing a Booby prize, a goat. (Sorry, no fancy
images or graphics to slow you down.)
- You have a chance to keep your original choice, or switch your bet to the
other closed door. Answer Yes or No to the "Switch bet?" question.
Folks believing that odds are now equal at this point will probably want to
press "No", thinking their original choice is just as good as switching.
- The prize is revealed and your running score tallied. If you're satisfied
with the results, press Quit; otherwise press "No, try again" to reset the
game, and continue tallying your score .
- Use the "Peek" button anytime if you think the simulation is cheating.
Of course, the answer is no. "Reset" will set your result tallies back to zero.
- You can run a simulation of three players, Mr. Confident who never switches
his bet; Mr. Bayes, who always switches his bet; and Mr. Random, who flips a
coin to decide whether or not to switch. 1000 games are run, and the results
displayed in a listbox. 1000 games for each of the three players may take
several seconds to run, depending on the speed of your machine.
You must have the
Tcl Plugin installed. Note: Mac plugin users should give Netscape
8000 kb or more of memory (see "Get Info".) Standalone Tcl interpreters for
Windows, Mac, and Unix can
also be found at Sunscript
Shift-click on
montyhall.tcl to download the source so you can
run it locally. The code is 100% Tcl/Tk, and is portable to Windows,
Macintosh, Unix/X11, as well as running in the Tcl Plugin under Windows
(Netscape & IE), Macintosh (Netscape), and Unix/11 (Netscape). Talk about
your Write Once Run Anywhere! Tcl really does it!
Background on the Monty Hall problem is here. You can
find other Web based simulations including ones in Javascript and Java
(which croaked on my machine :(