Most people familiar with the Monty Hall problem find it counter-intuitive that we should always accept the offer to change doors in the game, as that gives us a ~66% probability of success in the long run (vs. ~33% if we don’t change doors). You can read the Wiki article linked below to understand the logic behind it, but you can also simulate 300 attempts (x-axis) at the game to see how never changing vs. always changing doors affects the probability of success (y-axis).
The function in the code below,
mHall(), is a simple
simulation of the game (no arguments needed).
Copyright © 2022 Guilherme Duarte Garcia