You pick door 1; the host opens other doors; you may stay or switch. If the host knows where the prize is and always opens goat doors, the opened doors carry information about the prize and switching wins with probability (n−1)/n. If instead the host opens one door at random and it happens to show a goat, the likelihood is the same for every closed door and staying and switching are equally good: the posterior depends on how the data were generated, not only on what was seen. Run the game and watch the running win rates settle on the exact posteriors.
Each game places the prize uniformly, the contestant always picks door 1, and the contestant who switches moves to a closed door chosen uniformly among the other closed doors (only one for an informed host). For the random host, games in which the host happens to open the prize door are discarded: the data are conditioned on seeing a goat. The generator is seeded, so a class sees the same numbers.
code/ch02_probability_univariate.py (monty_hall_posterior, monty_hall_simulate).