Hacker News new | past | comments | ask | show | jobs | submit login

The variants where the host does not know are also worth considering. If they’re just guessing and happened to not open the prize door by chance, you’re back at 50/50. If they have a hangover and you think there’s a 5% chance they forgot where the prize is and still just happened to open the doors correctly, well that makes the math even more interesting.



As long as the host doesn't accidentally open the prize door, it doesn't matter whether he forgot or not. To test my statement you could write a simulation where the host randomly opens a door.


That's not right, and it's one of the more confusing parts of the problem in my opinion.

I can make sense of it by drawing out the probability trees and see that it's 1/2 rather than 2/3 in this case, but it actually sticks with me if I think more like so:

My prior is that there's a 1/3 chance I picked the car; that's the world where the host can't reveal anything other than a goat.

In the scenario where the host then reveals a goat intentionally, my prior doesn't change. The host can always reveal a goat. This gives me no information. Therefore, it's still 1/3 that I picked the car, so the remaining door must be 2/3, so I switch and get a 2/3 chance.

But in the scenario where the host reveals a door at random, and it happens to be a goat, it's time to update my priors. Since he didn't accidentally reveal the prize, the probability that I'm in the world where he couldn't accidentally reveal the prize is increased relative to the probability that I'm in the world where he could have.


See my simulation code.


Yeah, you still win 2/3 of the time. Some of those wins come from the host accidentally showing you the prize, which is prior to your decision.


Completely false. Draw up a probability table for the case where the host picks a door at random (so 1/3 times they reveal the prize) and you'll see.


What happens if the host reveals the prize? Is the game repeated? I'm saying as long as he doesn't accidentally open the prize door, it doesn't matter. If you insta-loose in that case, we're talking a different game.


> What happens if the host reveals the prize? Is the game repeated?

Maybe. Maybe you insta-lose. Maybe you insta-win. It doesn't matter. (But by definition if the host picks a door at random, there is a possibility that they will pick the door with the prize behind it, so something must happen in that case).

> I'm saying as long as he doesn't accidentally open the prize door, it doesn't matter.

But that's false. If the host picked the door to reveal at random then your chance is 1/2 if you switch and 1/2 if you keep your original door. The 1/3-2/3 case only happens if the host deliberately picked a door that didn't have the prize.


See for yourself:

  import java.util.List;
  import java.util.Random;
  import java.util.stream.Collectors;
  import java.util.stream.Stream;
  
  public class MontyHall {
    public static void main(String[] args) {
      Random random = new Random();
      final boolean GUEST_ALWAYS_SWITCHES = true /* change guest strategy */;
      final boolean HOST_IS_DRUNK = false /* simulate host knowledge */;
      final boolean GUEST_WINS_IF_HOST_PICKS_PRIZE_BY_ACCIDENT = true;
      final double GAME_COUNT = 1_000_000;
      double winCount = 0;
      for(int i = 0; i < GAME_COUNT; i++) {
        List<String> remainingDoors = Stream.of("A", "B", "C").collect(Collectors.toList());
        String prizeDoor = remainingDoors.get(random.nextInt(3));
        String guestInitialPick = remainingDoors.remove(random.nextInt(remainingDoors.size()));
  
        String hostPick;
        if(HOST_IS_DRUNK) {
          hostPick = /* host picks random */ remainingDoors.remove(random.nextInt(remainingDoors.size()));
        }
        else {
          // host is sober and always opens empty door
          hostPick = remainingDoors.get(0).equals(prizeDoor) ? remainingDoors.remove(1) : remainingDoors.remove(0);
        }
  
        if(hostPick.equals(prizeDoor)) {
          if(GUEST_WINS_IF_HOST_PICKS_PRIZE_BY_ACCIDENT) {
            winCount++;
          }
          continue /* insta win/loss */;
        }
  
        // guest decides to stick with inital pick or switch
        String guestFinalPick = guestInitialPick;
        if(GUEST_ALWAYS_SWITCHES) {
          guestFinalPick = remainingDoors.get(0);
        }
  
        if(guestFinalPick.equals(prizeDoor)) {
          winCount++;
        }
      }
  
      System.out.println(String.format("Win rate: %.2f", winCount / GAME_COUNT));
    }
  }


Try setting GUEST_ALWAYS_SWITCHES=false, you'll find your winrate is still 2/3.

In the if(hostPick.equals(prizeDoor)) block, rather than maybe incrementing winCount, you need to decrement GAME_COUNT (or rather the number that you're going to divide by at the end - don't reduce the number of iterations) - we're talking about the probability when you're deciding whether to switch (so after the host has already opened the door and not hit the prize).


My statement was that if you always switch, it doesn't matter whether the host is blind or not. But I must say it is an interesting find of the simulation that your win rate is always 2/3 independent of your strategy (provided the host is blind and you win when the host makes a mistake).

I'm always talking about the probability of winning the complete game when sticking to a certain strategy. I never look at intermediate probabilities.

Decrementing the game count or the divisor would be the like crossing out or ignoring decision tree branches.

If you change the game rules and say the game is repeated if the drunken host picks the prize, then the simulation would have to repeat until the guest has either won or lost, but the game count would still remain the same (= the number of times a simulated guest is invited to the game show).


> My statement was that if you always switch, it doesn't matter whether the host is blind or not.

Well, it does matter unless you have the rather unusual rule that you win if the host reveals the prize - normally it would make a lot more sense to say you lose in that case. (In fact this is the deep reason why switching works in the original problem - if you switch, then you win if a blind host "would have" revealed the prize, whereas if you don't switch, you lose).

The relevant general fact is that if the host is blind, your strategy never makes any difference.

> Decrementing the game count or the divisor would be the like crossing out or ignoring decision tree branches.

Well, there is no decision to be made if the host revealed the prize - you never get the choice of whether to switch or not. When we ask about the probabilities after a certain choice, at the point where you're making that choice you already know that you've certainly had to make that choice. Otherwise could equally well say that you have to include the probability of getting through to the final round, the probability of getting onto the gameshow in the first place, ...


You said: "I can make sense of it by drawing out the probability trees and see that it's 1/2 rather than 2/3 in this case"

(Edit: sorry that was not your statement, but that from furyofantares.)

Now you agreed that it is still 2/3, so I still stand by my statement "As long as the host doesn't accidentally open the prize door, it doesn't matter whether he forgot or not."

> Well, it does matter unless you have the rather unusual rule that you win if the host reveals the prize

If you change the game and say the host is blind, you have to also make a rule about what happens if the blind host reveals the prize. Otherwise how could you decide on a strategy as a guest?

> Well, there is no decision to be made if the host revealed the prize

No chance for the guest to switch, yes, but it is still a branch in the whole probability tree, and you have to count it either as a win or a loss for the guest. They can't just all go home and pretend the show didn't happen.

> Otherwise could equally well say that you have to include the probability of getting through to the final round, the probability of getting onto the gameshow in the first place, ...

The problem statement is: "What strategy (stick or switch) is best for the guest (= has higher probability to win), provided he gets into the game show final." No ambiguity here.


> If you change the game and say the host is blind, you have to also make a rule about what happens if the blind host reveals the prize.

The most natural rule is that the guest loses: the guest picked a door that didn't have the prize, they get what's behind "their" door. (And note that the much-argued formulation already "changes" the game from what was done on the original gameshow).

> The problem statement is: "What strategy (stick or switch) is best for the guest (= has higher probability to win), provided he gets into the game show final."

Why "provided he gets into the gameshow final" and not "provided he gets into the gameshow final and is offered the chance to switch"? Like, if you're asking whether a chess player should take an en passant capture, you'd look at whether capturing or declining en passant leads to winning more often, you wouldn't look at all possible chess games (including those where there was no chance to capture en passant) because that just adds a bunch of irrelevant cases.


> The most natural rule is that the guest loses

I don't want to argue which rule would be more natural or make a more interesting show. But without a clear rule, I cannot decide on a playing strategy.

> Why "provided he gets into the gameshow final"?

Because I assumed that the host always has to open a door and give a choice to switch.


> I don't want to argue which rule would be more natural or make a more interesting show. But without a clear rule, I cannot decide on a playing strategy.

It doesn't make any difference to your strategy! You don't get any choice if the host opens the door and reveals the prize, so your strategy can't possibly be affected by what the payoff for that scenario is - even if you win 10x the prize if that happens, or get executed if that happens, it makes no difference to whether you should switch or not in the scenario where you actually do get given a choice.


I agree you do not need a strategy if the rule is insta win/loss.

But if the rule were to reset the game until the host doesn't make any more mistakes, it matters.


No it doesn't. If the host chose randomly and revealed a non-prize, i.e. the point where you're making the choice, your odds are 1/2 for either door and your strategy doesn't matter.


There's a third rule set where switching always makes you lose:

Guest selects a door. If it has a goat behind it, the host opens that door and says "you lose". If the guest initially picks the car, then the host opens a different door and asks the guest if they want to switch.

For the player, if you've reached the point that the host is offering you to switch, there's no way to know whether you are in the case where switching improves your odds to 2/3, keeps them the same, or decreases them to zero.


> My statement was that if you always switch, it doesn't matter whether the host is blind or not.

You responded to someone who said it's back to 50/50 once a random host reveals a goat.

I thought you were contradicting this or adding to it, but if you were saying it doesn't matter if you switch, then yeah, that's what 50/50 means.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: