Three door game

billwald

Contributor
Oct 18, 2003
6,001
31
washington state
✟6,386.00
Faith
Christian
Marital Status
Married
The game show where the contestant gets the contents of a room behind a closed door. The contestant chooses a door. The "host" opens a 2nd door and the room is empty. Host asks if the contestant if he wants to change his guess.

It is claimed that the person improves his chances of winning if he changes his guess. I wrote a quick BASIC program which seemed to indicate the person was better off to stay with his original guess.

Anyone out there willing to write a BASIC (or other) simulation? (I only know BASIC)
 

ragarth

Well-Known Member
Nov 27, 2008
1,217
62
Virginia, USA
✟1,704.00
Faith
Humanist
Marital Status
Single
If I understand correctly, there are three doors, A B and C. The contestant chooses A and the host opens B. Once open, door B is empty. Assuming there is only 1 prize then some basic math will give us statistics:

with three choices and 1 target, we get a 1:3 chance or a 33% chance of success.
with two choices and 1 target, we get a 1:2 chance or a 50% chance of success.

The act of the contestant changing their choice will not impact their chances. Opening the empty door only modifies the knowledge of that door, not of the other doors, and therefore the chances of success are 50% no matter which door is chosen.
 
Upvote 0

Washington

Well-Known Member
Jul 3, 2003
5,092
358
Washington state
✟7,305.00
Faith
Agnostic
If I understand correctly, there are three doors, A B and C. The contestant chooses A and the host opens B. Once open, door B is empty. Assuming there is only 1 prize then some basic math will give us statistics:

with three choices and 1 target, we get a 1:3 chance or a 33% chance of success.
with two choices and 1 target, we get a 1:2 chance or a 50% chance of success.

The act of the contestant changing their choice will not impact their chances. Opening the empty door only modifies the knowledge of that door, not of the other doors, and therefore the chances of success are 50% no matter which door is chosen.
One would think it's that simple, but I invite you to check out the link I provide above in post #2.
 
Upvote 0

ranmaonehalf

Senior Member
Nov 5, 2006
1,488
56
✟9,473.00
Faith
Atheist
The game show where the contestant gets the contents of a room behind a closed door. The contestant chooses a door. The "host" opens a 2nd door and the room is empty. Host asks if the contestant if he wants to change his guess.

It is claimed that the person improves his chances of winning if he changes his guess. I wrote a quick BASIC program which seemed to indicate the person was better off to stay with his original guess.

Anyone out there willing to write a BASIC (or other) simulation? (I only know BASIC)
its basic math,statically you likely chose the wrong door. you have a 1/3 chance of choosing it.
so you statically likely chose the wrong door.

with that one wrong answer taken out of the equation and the likley wron door you are more likley to choose the right door this time.
 
Upvote 0

Tinker Grey

Wanderer
Site Supporter
Feb 6, 2002
11,226
5,621
Erewhon
Visit site
✟930,098.00
Faith
Atheist
It is important to understand the original scenario which is this:

0) There is one good choice and two bad choices.
1) The contestant gets an initial choice.
2) The host will reveal one of the two remaining doors.
3) The contestant gets to decide (given what the host has revealed) to switch or stay.

The simplest way to look at, for me, is this: If the contestant has a 1/3 chance of getting it right in step one, then the host has a 2/3 chance that he will have no choice whatsoever of what door to choose. (He will never reveal the good door.) If he has no choice as to what door to choose it is because the other door is the good door. So, 2/3 of the time you should switch. Or, you have a 66% chance of winning if you switch and a 66% chance of losing if you stay.

I can't give you a BASIC program, but I can give you pseudo-code:
  1. Initialize a (nx3) array with the n equaling the number of of trials you wish to perform. Initialize to zero.
  2. Loop thru the array.
    • For each row (1x3), 'roll' your random number generator (RNG).
    • If your random number generator has a value less than 1/3 of the total range of the (RNG), set (n,1) to 1. If your RNG has value between 1/3 of its range and 2/3s of its range, set (n,2) to 1. If your RNG has value greater than 2/3 of its range, set (n,3) to 1.
  3. Now re-loop over your array.
  4. For each 'n', roll your RNG. Use the same range scheme to determine which bin your contestant has chosen (1, 2, or 3).
  5. If the bin that your contestant chose was the winning bin, increment the number of losses -- because a switch would be a loss since both the other choices are a loss.
  6. If the bin that your contestant chose was a 'loser', then a switch would be a win since the host would reveal the other losing door. So, don't increment anything.
  7. When you are done looping, divide your # of losses by 'n'. This is the odds of losing by switching.

You should find that losses/n approaches 1/3 -- this is the odds of losing by switching. This means that the odds of winning by switching is 2/3.

Of course, you could count the number of wins by switching which would be wins/n which would approach 2/3.
 
Upvote 0

JBJoe

Regular Member
Apr 8, 2007
1,304
176
Pacific Northwest
Visit site
✟22,711.00
Faith
Christian Seeker
Marital Status
Married
Politics
US-Democrat
The game show where the contestant gets the contents of a room behind a closed door. The contestant chooses a door. The "host" opens a 2nd door and the room is empty. Host asks if the contestant if he wants to change his guess.

It is claimed that the person improves his chances of winning if he changes his guess. I wrote a quick BASIC program which seemed to indicate the person was better off to stay with his original guess.

Anyone out there willing to write a BASIC (or other) simulation? (I only know BASIC)
Afraid I don't have a BASIC interpreter, my scripting language of choice is Python. So here's my simulation in Python (you can get a python interpreter at python.org):

Code:
# Seed can be anything you want or "None" to let Python choose
SEED = 0xA1072F32
# The number of trials to perform, the larger the better
TRIALS_COUNT = 10000
# Whether or not to always change (True or False)
ALWAYS_CHANGE = True
# Number of doors, traditionally 3
DOORS_COUNT = 3

import random

random.seed(SEED)
losses = 0.0
wins = 0.0
for x in xrange(TRIALS_COUNT):
    # create the 3 doors
    doors = ["lose"] * DOORS_COUNT
    # randomly place a prize behind one
    prize_door = random.randint(1,DOORS_COUNT)-1 # -1 because of zero index
    doors[prize_door] = "win"

    contestant_pick = random.randint(1,DOORS_COUNT)-1
    contestant_door = doors[contestant_pick]

    if ALWAYS_CHANGE:
        if contestant_door == "win":
            losses = losses + 1.0
        else:
            wins = wins + 1.0
    else:
        if contestant_door == "win":
            wins = wins + 1.0
        else:
            losses = losses + 1.0

print "# of wins = %d" % wins
print "# of losses = %d" % losses
print "ratio = %f" % (wins/TRIALS_COUNT)
And here's sample output from it:
Code:
# of wins = 6599
# of losses = 3401
ratio = 0.659900
So as we expect, if you have 3 doors and you always change, you win approximately twice as often as you lose.

Interesting results are achieved when we greatly increase the # of doors. For example if there are 100 doors, and Monty always reveals all but 1 door, you will win 99% of the time if you always switch:
Code:
# of wins = 9907
# of losses = 93
ratio = 0.990700
 
Last edited:
Upvote 0

JBJoe

Regular Member
Apr 8, 2007
1,304
176
Pacific Northwest
Visit site
✟22,711.00
Faith
Christian Seeker
Marital Status
Married
Politics
US-Democrat
Wouldn't it make more sense to print the proportion of wins, as in wins/TRIALS_COUNT? Maybe it's just me not being a numbers person, but I find that far more intuitive than the ratio.
Good suggestion. I went ahead and changed it, thanks.
 
Upvote 0
This site stays free and accessible to all because of donations from people like you.
Consider making a one-time or monthly donation. We appreciate your support!
- Dan Doughty and Team Christian Forums