Monty Hall Redux

On the contrary, anytime I’ve seen the puzzle stated in the wild, including the version in Marilyn’s 1990 Parade column, assumption #3 is never made explicit. It’s always stated, IME, as something that happened in this one trial, without any indication that Monty was constrained by the rules so that he had to offer the choice to switch. And that unstated assumption makes all the difference.

I’d at least like to see your JavaScript, just for comparison’s sake. If you’d rather PM it, I’d be fine with that, but I thought I’d post in the thread first.

In fact, when I wrote this, I wrote it in VBScript, because it’s close the Qbasic I learned as a child. I only afterwards converted it to JavaScript, as I thought that’d be easier to share.

Argh! I forgot the Javascript was never finished. Sorry.

Oh hum.

Now if you wrote it in Zombie, that would be cool!

I can read C and Java, at least. They aren’t that different.

I think this may be part of the reason why people have such a hard time accepting that you should switch in this particular scenario: while probability favors switching when the puzzle is explained properly, it is very, very easy to change the rules in a slight way or forget a part that make the probability the same. I very specifically remember a Parade in which this answer was used but enough information was omitted that, in reality, the odds when/if you switched were the same.

This is untested, so I am not liable if anything bad happens to you. Make sure you take the proper precautions before trying to run, like protection spells and stuff.


count is a zombie
summon
    remember 1
bind

Wins is a zombie
summon
    remember 0
bind

losses is a zombie
summon
    remember 0
bind

Door1 is a zombie
summon
    forget
    remember 0
bind

Door2 is a zombie
summon
    forget
    remember 0
bind

Door3 is a zombie
summon
    forget
    remember 0
bind

GUESS is a vampire
Summon
    task Guess1
        forget
        remember 1
        shamble around
    bind
    task Guess2
        forget
        remember 2
        shamble around
    bind
    task Guess3
        forget
        remember 3
        shamble around
    bind
disturb

PRIZE is a vampire
Summon
    task Guess1
        forget
        remember 1
        shamble around
    bind
    task Guess2
        forget
        remember 2
        shamble around
    bind
    task Guess3
        forget
        remember 3
        shamble around
    bind
disturb

SWITCH is a vampire
Summon
    task Switch
        forget
        remember true
        shamble around
    bind
    task NoSwitch
        forget
        remember false
        shamble around
    bind
disturb

RANDOM is a vampire
Summon
    task Open1
        taste remembering GUESS 1
            good remember Door2 -1            
        bad spit
        taste remembering GUESS 2
            good remember Door3 -1
        bad spit
        taste remembering GUESS 3
            good remember Door1 -1
        bad spit
    bind

    task Open2
        taste remembering GUESS 1
            good remember Door3 -1            
        bad spit
        taste remembering GUESS 2
            good remember Door1 -1
        bad spit
        taste remembering GUESS 3
            good remember Door2 -1
        bad spit
    bind
disturb

Percentage is a zombie
Summon
    invoke count 
    shamble
        remember moan Percentage rend moan wins remember moan wins moan losses
        remember count 1 moan count
    until remembering count 100    

Main is a zombie
Summon
    shamble
        invoke Door1
        invoke Door2
        invoke Door3
        banish PRIZE
        invoke PRIZE
        taste remembering PRIZE 1
            good remember Door1 1
        bad spit
        taste remembering PRIZE 2
            good remember Door2 1
        bad spit
        taste remembering PRIZE 3
            good remember Door3 1
        bad spit        
        banish GUESS
        invoke GUESS
        taste rememebering GUESS moan PRIZE
            good 
                banish RANDOM
                invoke Door1
                invoke Door2
                invoke Door3
                invoke RANDOM
            bad
                taste remembering GUESS 1
                    good taste remembering PRIZE 2
                        good remember Door3 -1
                        bad remember Door2 -1 
                    spit
                bad spit
                taste remembering GUESS 2
                    good taste remembering PRIZE 1
                        good remember Door3 -1
                        bad remember Door3 -1
                    spit
                bad spit
                taste remembering GUESS 3
                    good taste remembering PRIZE 2
                        good remember Door1 -1
                        bad remember Door2 -1
                    spit
                bad spit
            spit

            banish SWITCH
            invoke SWITCH
            taste remembering SWITCH true
                good taste moan GUESS 1
                    good taste moan Door3 -1
                        good remember GUESS 3
                        bad remember GUESS 2
                    spit
                bad spit
                good taste moan GUESS 2
                    good taste moan Door2 -1
                        good remember GUESS 1
                        bad remember GUESS 3
                    spit
                bad spit
                good taste moan GUESS 3
                    good taste moan Door2 -1
                        good remember GUESS 1
                        bad remember GUESS 2
                    spit
                bad spit
            bad spit
            
        taste remembering GUESS moan PRIZE
            good taste remembering SWITCH true
                good remember wins moan wins 1
                bad remember losses moan losses 1
            spit
            bad taste remembering SWITCH false
                good remember wins moan wins 1
                bad remember losses moan losses 1
            spit
        bad spit
        
        remember count moan count 1
    until remembering count 10000

    say moan wins
    say moan losses
    say moan percentage
animate

This is so cool. Love that syntax.

Isn’t it fairly obvious, if you choose a door and Monty DOESN’T open another door but just gives you the chance to switch, nothing has happened to change the odds (still 1/3 for each door)? That’s sort of a no-brainer, n’est-ce pas?

It depends on the rules of the game. If Monty always offers the chance to switch, then you’re right. But if his decision to extend the offer is contingent in some way on the contestant’s original choice, then the probability is different. Different assumptions, different outcome, which is kind of CurtC’s point.

Missed Edit Window: Part of the issue here is that, often, the assuption that the host must offer a switch is unwritten. Since the problem is based on a real gameshow with a real host who was NOT constrained to always offer the switch (at least, according to Monty himself), it’s not surprising that people don’t necessarily assume the host is constrained.

Well, here’s the Ruby version:


#!/usr/bin/ruby
# Define the doors.
# Their only property is that they are either open or closed
class Door
    # Open the door
    def open; @open = true; end
    # Close the door (at the beginning of the game)
    def close; @open = false; end
    # Is this door open?
    def open?; @open; end
end

# Define the player
# This is a simple player
class Poor_player
    # Our first choice is random
    def initial_choice; @initial = rand 3; end
    # Our second choice is to stand pat
    def second_choice; @initial; end
end

# Define Monty
# Monty knows where the prize is, and will tell you if you won
class Monty
    # Tell Monty at the beginning which one wins
    def whisper(prize); @prize = prize; end
	# Ask Monty whether the door is the right one
	def winner?(choice); choice == @prize; end
	# Monty chooses a door to open
	def open(choice)
        # If the player's choice is the winner, Monty can choose one of two doors
        # Otherwise, he has only one choice
        which = choice == @prize ? rand(2) : 0
        # Scan the doors
        $doors.each_with_index do |door, i|
        case i
            # If this is the door the player chose, or the winning door, don't open
            when choice, @prize
            else
                # Otherwise, possibly open this door
                if (which == 0)
                    door.open
                    return
                # If we didn't open, we will have to open the next 
                else
                    which -= 1          
                end
            end
        end
    end
end

# Simulate a game
def simulate
    # Start by closing all the doors
    $doors.each {|door| door.close}
    # Tell Monty where the prize is
    $monty.whisper(rand(3))
    # Tell the player to make his first choice
    choice = $player.initial_choice
    # Tell Monty to open a door
    $monty.open(choice)
    # Tell the player to make his second choice
    choice = $player.second_choice
    # Ask Monty whether the player won
    $monty.winner?(choice)
end

# Now we are ready to play
# Create Monty
$monty = Monty.new
# Create the player
$player = Poor_player.new
# Create three doors
$doors = []; 3.times {$doors << Door.new}

# Run 100000 simulations
sum = 0; 100000.times {sum += 1 if simulate}
puts "Poor player won #{sum} times."

# Give the player an improved rule for the second choice
def $player.second_choice
    # Scan the doors until we find one that isn't open, and that we didn't choose
    $doors.each_with_index {|door, i| return i unless i == @initial or door.open?}
end

# Run 100000 more simulations
sum = 0; 100000.times {sum += 1 if simulate}
puts "Smarter player won #{sum} times."

If you don’t know why Monty offered the choice, there is no way to calculate the probabilities. Consider:

  1. The evil Monty. He offers the option to switch only when a contestant picks the correct door on his first guess. In this situation, your chance if you switch is 0%.

  2. The helpful Monty. He offers the option to switch only when a contestant has picked the wrong door on his first guess. In this situation, you will always win by switching.

  3. The constrained Monty. The show’s producer forces Monty to always offer the switch. This is the classic solution with the answer of 2/3 chance if you switch.

  4. The playful Monty. He offers the switch just often enough that a contestant has no advantage if he switches. The odds here are 50/50.
    Now, if the setup to the puzzle does not specify Monty’s method, why would anyone assume it’s #3?

ETA: There’s another strong possibility, the oblivious Monty, who doesn’t know which door holds the prize, and in this case he just happened to open a goat-door. Your odds here are also 50/50. BTW, the old Parade column did rule out this possibility.

I’ve been thinking about this and I’m not convinced either.

The logic of the idea is that 2/3 of the time you will pick the losing door. Therefore, if you always switch, you will win 2/3 of the time. Of course the 1/3 of the time you pick the winner, you will lose.

However it seems to me that this approach assumes that random events have a memory - which of course they don’t. Take the following example.

Let’s say that instead of always switching, you chose which door you will ultimately select by tossing a fair coin. So regardless of your first choice, when you are offered the switch, you will flip a coin - heads means you pick the first available door that is left and tails means you select the other available door.

Using this method, your long term chances of winning are 50-50.

The problem I see with the hypothetical is the fact that even before you start, you know that one door will be revealed to be a loser. So from the beginning, your choice is really between 2 doors - the one you pick, and the other one. In that instance, your odds will always be 50-50.

To put it another way, the hypothetical is actually 2 separate and unrelated events. The initial choice is irrelevant because one of the 3 doors will always be eliminated. The real choice is between the 2 that remain. The odds of that choice being correct will always be 50-50.

If you randomly chose whether to switch or not, yes, you’ll end up with a 50-50 chance. That’s actually better than just picking a door once, but math and practical experiment shows that, if one door is always eliminated, switching gives you a 66% chance of winning.

No, it’s only 50-50 if you randomly chose whether to switch or not. Your initial choice is a 1/3 chance. You have the confused idea that this requires random events to have memory, but your explanation requires random events to be prescient.

Yes, but I think you may be misunderstanding the reason. If you stick, you win 1/3 of the time. If you switch, you’d win 2/3 of the time. Using a coin toss to decide between these two strategies, you’d win an amount that’s the mid-point between those two, which is 1/2 of the time. But so what?

If you made your initial choice and monty opened all of the doors, yes, you would win 1/3 of the time. This would be the first event.

The second event is completely unrelated since opening one of the doors gives you no new information. You knew from the beginning that

  1. a door would be opened
  2. the door would be a loser

So while your odds for the first event were 1/3, for this event, they are 1/2. You can’t escape that fact. Therefore, if you consistently switch or not, you’re odds are the same. there is NO advantage.

If you code this as a monte carlo simulation, you have to code it as 2 separate events, not one. As soon as you see this, you realize that the odds of the 2nd choice are always 50-50.

BTW, this does not violate the statical weighting in the first choice. At the end of phase 1, you have 1/3 chance of winning and 2/3 chance of losing. Once a choice is eliminated, since it will always be a losing choice, you have 1/2 of 2/3 chance of winning if you switch and 1/2 of 1/3 chance of winning if you don’t. 1/2 of 2/3 is about 33%. 1/2 of 1/3 is about 17%. So your total chance of winning is 33% + 17% = 50%.

As you can see, the math still works. The problem was that Marilyn did not take her analysis far enough.

There’s no need to multiply by one half unless you’re flipping a coin for whether to switch or not.

If the chances of winning by switching are no longer 2/3 after the opening of a door, then what is that term doing in your calculations?

If for simplicity’s sake we say you always pick door one first you get the following end situations:
You picked door one, door one’s a winner, you switch, you lose.
You picked door one, door two’s the winner, door three is opened, you switch, you win.
You picked door one, door three’s the winner, door two is opened, you switch, you win.

2/3 chance of winning if you switch. And as I said, given the condition that one door is always eliminated, this is what math and simulation shows us is fact.

But this ignores the fact that one of the choices will always be eliminated, leaving the odds at 50-50.

Here is an example that highlights what I’m trying to say.

Let’s say that monty decides in advance which losing door he will choose, such that, if a contestant chooses that door, he will be told to make another selection. Let’s say monty’s door is door #2.

Now you have 2 possible scenarios.

  1. The contestant chooses door 1 or 3 (one of which has to be the winner)
  2. The contestant chooses door 2 and is told to try again. This leads to the same result as scenario 1.

Is there any doubt that in both cases the odds of picking the winning door are 50-50?

The point is that from the very beginning you know that a losing choice will be eliminated. Therefore, the odds of winning or losing at the second stage have to be 50-50.

Isn’t this the same method they use on Deal or No Deal? It’s the player not the host who chooses which suitcases to open after he makes his initial choice. That’s why there would be no point in switching if that was an option on that show - your first choice is as good as any subsequent choice you could make.