3 ms·
>it simulates a situation where we count the times when Monty picks the car. No, it does not. >> if (montys_choice === car_door) { i -= 1; continue; } Thi
by Arnavion 6y ago
>it simulates a situation where we count the times when Monty picks the car.
No, it does not.
>> if (montys_choice === car_door) { i -= 1; continue; }
This discards the game where Monty chose a car.
>> do { montys_choice = Math.floor(Math.random() * 3); } while (montys_choice === my_choice || montys_choice === car_door);
This makes Monty never choose a door with a car.
Neither one counts the game where Monty opened a door with a car as a win for either staying or switching.
- IggleSniggle 6y agoThank you (and everyone else in this thread) for sticking with it with me. It was a struggle to read that single line of code on a cell-phone screen, and that was compounded by the fact that it turns out that I don't understand the Monty Hall problem when I thought that I did. I'm going to sit with this one for awhile.