During college, I read about the Monty Hall problem and it was so counter-intuitive, I could not believe it and thought of it as just a theoretical analysis and the real life situation would still be same for both the situation. Later, I forgot about it.
Very recently, I again read about it and I remembered that I was skeptical about it the last time. But, now I could write code.
So, I wrote a code which randomly puts prize in one of the three doors. Then, the player has a random first guess. The game then opens an empty gate and the player is given a chance to change his earlier choice. I tracked number of wins separately for both the situations when the player changes their first choice and when they do not.
Surprisingly (for me, not for those who understood the analysis properly), the result is better when the player chose to change their first choices. Double, to be precise.
The analysis loosely translates to the fact that, if you do not change your choice, your probability still remains 1/3 whereas, if you select, it becomes 1/2 since the second time, only two options left.
I understood the argument properly even the first time. But, did not realise how deeply the concept of probability is entangled with our day-to-day situations. It was overwhelming for me and I wanted to share this with all of you.
You can find the code here. Do let me know what do you think about the problem.