Hacker News new | ask | show | jobs
by aonsager 1835 days ago
It's a 1/2 chance at the point where you're considering the switch.

If you start the game with the intention of switching, you have a 2/3 chance of being successful because the winning strategy is to miss the car on your first pick.

2 comments

No, I don’t think this is right.

Regardless of your intended plan, you only had a 1/3 chance of picking correctly the first time, so switching gets you a 2/3 chance.

No, it's a 2/3 chance at that point.

When you choose initially, you have a 1/3 probability of getting the right one, leaving a 2/3 probability that the car is on one of the other two.

The host reveals one of the other two. So that 2/3 probability applies to the remaining door. Here is a short C implementation that made it very clear to me...

  #include <stdio.h>
  #include <stdlib.h>

  int doround () {
    int car = rand() % 3;
    int firstchoice = rand() % 3;

    // host reveals one of the goat doors

    if (car == firstchoice) {
      // you changing to the other door after the reveal is a loss
      return 0;
    }

    if(car != firstchoice) {
      // you changing to the other door after the reveal is a win
      return 1;
    }
  }

  int main(int argc, char** argv) {
    int wins=0;
    for (int round=0; round < 1000; round++){
      wins+=doround();
    }
    printf("Worked in %d of %d rounds\n", wins, rounds);
  }