3 ms·
Those runs get ignored since that isn't the scenario. Specifically we're looking at the case where Monty opens a goat by chance (ie. he could have opened the ca
by grraaaaahhh 7y ago
Those runs get ignored since that isn't the scenario. Specifically we're looking at the case where Monty opens a goat by chance (ie. he could have opened the car, but did not). It also helps that that result doesn't matter to the overall question, is it better to switch or to stay, since both options are irrelevant when Monty opens the car door.
- semiotagonal 7y agoRESCINDED: Error in my simulation! Apologies.
- sparky_z 7y agoYou're accidentally including the cases where montysPick == myPick. You have to discard those cases. Monte has to show you what's behind a different door than the one you initially picked. The game doesn't make sense otherwise.
- semiotagonal 7y agoYes you are correct. 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
- reidjs 7y agoHah, I wrote one as well to prove it to myself in the chrome dev tools console 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)
- Dylan16807 7y agoBy deleting the universe 1/3 of the time, you change the nature of the problem. It starts to resemble a quantum immortality argument. And if I can delete universes where certain events happen then screw probability, I can guarantee a win despite picking randomly. "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.
- OscarCunningham 7y agoConditional probability is a coherent concept with no need to talk about deleting universes. You can ask "If it's raining in the morning how likely is it to still be raining in the afternoon?" even though it's sometimes not raining in the morning.
- Dylan16807 7y agoConditional probability is fine. But you have to make the condition part of the question. You can't subtly omit certain results because it screws up the narrative. 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.