Home

Simulation of the Monty Hall problem

This software was largely created by AI Vibe Coding
Created by YouMinds
This simulation demonstrates the Monty Hall problem — a classic probability paradox where you pick one of three doors, the host reveals a goat behind another, and you choose whether to stay or switch.
The puzzle is famous because switching doors gives a higher chance of winning, even though it feels counter‑intuitive. This simulator lets you explore that paradox step‑by‑step or automatically, track results, and visualize outcomes in a live bar chart.
Games played: 0
What is the Monty Hall problem anyway?
The Monty Hall problem is a famous probability puzzle based on a game show scenario. In the game, a contestant is presented with three doors. Behind one door is a valuable prize (like a car), and behind the other two doors are goats (or other non-prizes). The contestant picks one door, but before it is opened, the host, who knows what is behind each door, opens one of the remaining two doors to reveal a goat. The contestant is then given the choice to either stick with their original choice or switch to the other unopened door. The counterintuitive solution is that switching doors actually gives the contestant a 2/3 chance of winning the prize, while staying with the original choice only gives a 1/3 chance.
Where did the problem come from?
The Monty Hall problem is named after Monty Hall, the original host of the television game show "Let's Make a Deal." The problem was popularized in a letter to the editor of "Parade" magazine in 1990 by Marilyn vos Savant, who is known for having one of the highest recorded IQs. In her column, she presented the problem and provided the solution, which sparked widespread debate and confusion among readers. Many people initially found the solution counterintuitive, leading to extensive discussions and analyses in both academic and popular circles.
Why does switching increase the chances of winning?
When the contestant first picks a door, there is a 1/3 chance that they chose the door with the prize and a 2/3 chance that they chose a door with a goat. When the host opens one of the remaining doors to reveal a goat, these initial probabilities do not change. The chosen door still has a 1/3 chance of winning, while the two unchosen doors together still hold a 2/3 chance.
Because the host always reveals a goat, the entire 2/3 probability shifts to the only remaining closed door. Therefore, switching to that remaining door doubles the chance of winning from 1/3 to 2/3.
Most people assume:
P(car behind either remaining door) = half of 100% = 50%
But this would only be true if the host opened one of the 3 doors at random. He does not. He opens one of only 2 doors conditioned on your choice and his knowledge of the prize. This conditional behavior is what shifts the probability.

Each door has a 33% probability of winning. All probabilities sum up to 100%.

The player chooses a door. The probability of the chosen door is 33%, and the probability of the remaining two doors combined is 66%.

If the host were to open a door before the player makes a choice, the probability of the remaining closed doors would be 50%. But in the actual Monty Hall setup, the host opens a door with a goat only after the player has chosen, and only from the reduced set of two unchosen doors.
This detail is crucial.

The probability of the opened door becomes 0%. This means the probability of the remaining closed door becomes 66%, since the total probability must always sum to 100%.

The player switches to the remaining closed door, which now has a 66% chance of winning.

The player wins.
How was it built
This software was created using Vibe Coding by a Large Language Model LLM / chatbot and reworked in look & feel.
Some features had to be implemented manually and corrections and improvements had to be made.
The following Vibe Coding prompts were used on Copilot:
"create a single page html page with javascript. Simulate the monty hall problem with 3 doors. create a graphic representation of the 3 doors. Prozess the game step by step and let the user press a next button for the next game. Collect and display statistical data. create a checkbox that will either have the player swith doors or keep the initial door."
"why do I loose when I choose the correct door initially. Also when the game finishes show everything behand every door. When pressing next, choose door random automatically. Or when the user clicks on a door choose that one."
"Add a button to run and stop the game automatically on 0,5 second steps. Also add a barchart with the results.