the singularity of being and nothingness
Posts tagged Monty Hall Problem

Monty Hall Problem…in ColdFusion
Jun 6th
If you saw my post about the Monty Hall Problem, you know that calculating the probabilities in this puzzle, while not terrifically complicated, are nonetheless a bit frustrating to our feelings of common sense. Therefore, I decided to whip up a quick script that would simulate the Monty Hall problem in code.
It turns out that this has been done many times before, and if you head on over to rosettacode.org, you can find scripts for nearly every language you could imagine…except ColdFusion.
Thinking this to be an incredible travesty, I have produced a CF version of the problem, and have posted it over at rosettacode.org.
If you’re too lazy to click a link, however, here is the script in its entirety:
<cfscript> function runmontyhall(num_tests) { // number of wins when player switches after original selection switch_wins = 0; // number of wins when players "sticks" with original selection stick_wins = 0; // run all the tests for(i=1;i<=num_tests;i++) { // unconditioned potential for selection of each door doors = [0,0,0]; // winning door is randomly assigned... winner = randrange(1,3); // ...and actualized in the array of real doors doors[winner] = 1; // player chooses one of three doors choice = randrange(1,3); do { // More >

More Probability Fun: The Monty Hall Problem
Jun 5th
This is a classic!
Consider you’re on the game show Let’s Make a Deal!. The game is simple: there are 3 doors presented to you. One of the them has a fabulous prize behind it, while the other two hide nothing but shattered dreams.
When you initially select a door, the host (Monty Hall) will reveal one of the doors which hides your shattered dreams. Because Monty knows which doors conceal what, he will always reveal one door that is empty, while always leaving 1 empty and 1 prize door.
* If you initially select the winning door, Monty will reveal an empty door. * If you initially select an empty door, Monty will reveal the other empty door.
Left with two doors (one with the prize, the other with nothing), you have the opportunity to either stick with your initial selection, or vacillate entirely and change your mind, selecting the other remaining door.
So the question is simple: Should you stick or change?
The answer, quite counter-intuitively, is that you should most definitely change.
WHAT?? How does this make any sense? If there are two doors left, surely the probability of winning or losing is equivalent, right?
Nope. But why?
Let’s look at this in steps.
Initially (unconditioned), the probability of selecting More >