Monte has to show you what's behind a different door than the one you initially picked. The game doesn't make sense otherwise.
Corrected simulation gives 50/50 when Monty picks at random among 3 doors.
switchWins=33044 switchLoses=33581
#include <stdio.h> #include <stdlib.h> #include <time.h> #include <string.h>
#define NUM_RUNS 100000 #define NUM_DOORS 3 int main(int argc, const char* argv[]) { srand(time(NULL)); char doors[NUM_DOORS]; int switchLoses = 0; int switchWins = 0; for(int i = 0; i < NUM_RUNS; i++) { memset(&doors, 0, sizeof(doors)); doors[rand() % NUM_DOORS] = 1; int myPick = rand() % NUM_DOORS; int montysPick = rand() % (NUM_DOORS - 1); if(montysPick >= myPick) montysPick++; if(doors[montysPick]) continue; if(doors[myPick]) switchLoses++; else switchWins++; } printf("switchWins=%d switchLoses=%d\n", switchWins, switchLoses); return 0; }
EDITED TO ADD:
Just for further info:
3 doors: switchWins=33111 switchLoses=33470
4 doors: switchWins=50182 switchLoses=24698
8 doors: switchWins=74876 switchLoses=12687
100000 doors: switchWins=99998 switchLoses=2
const pickCar = (switchChoice) => {
const doors = [0, 0, 0];
doors[(Math.random() * doors.length - 1) | 0] = 1
let pick = (Math.random() * doors.length - 1) | 0
let goat
for(let i = 0; i < doors.length; i++) { if (doors[i] == 0 && i != pick) goat = i }
let result = pick
if (switchChoice) for(let i = 0; i < doors.length; i++) { if (i != pick && i != goat) result = i }
return result
}
let switchWins = 0;
let switchLosses = 0;
for(let i = 0; i < 100000; i++) {
pickCar(true) == 1 ? switchWins++ : switchLosses++
}
console.log('wins:', switchWins, ', losses: ',switchLosses)"Picks a random door out of all closed doors, but that door is never the winner" is a contradiction. It doesn't give you a different chance of winning because it's not a coherent scenario in the first place.
This is a game where you start off with a certain layout, and then proceed forward. If you want conditions, they have to be conditions that you can apply before the game starts. You can't retroactively remove a significant chunk of samples.
If you added an actual outcome to him picking the winner, you could make a valid filter where the answer actually is 50:50. Perhaps they restart the game. Perhaps they never air the episode. And if you calculate only for finished/aired games then it's very clear then that you're solving a different math problem. You can't apply that answer to the original problem.