mehmetguduk / Monty-Hall-Problem-Simulation

πŸ€ Monty Hall Problem Simulation is a simulation of a math problem. There will be 3 doors. Behind the two doors there will be a goat, behind the one door there will be a car. You will try to choose the car by deciding the door that you want to choose.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

πŸ€ Monty Hall Problem Simulation

How to play?

  • run MAIN.py . (You can run no_emoji_version.py too if you have issue about emojies in the code.)
  • Select a game speed in range 1-5 by typing to the terminal. Gamespeed 1 is the slowest, 5 is the fastest.

There will be 3 doors in the simulation. Behind the two doors there will be a goat, behind the one door there will be a car. You will try to choose the car by deciding the door that you want to choose.

  • At the first part of the simulation, you will choose a door and the program will open another door with a goat inside.
  • At the second part of the simulation, you will decide between the remaining two doors. Do you want to keep your choose or want to change it ?
  • At the third part of the simulation, you will see the inside of all doors and your result.

According to the Monty Hall Problem, when you decide to change your first decision at the second part, you will have a more chance of winning the car than in the scenario where you did not change your decision.

  • By typing anything other than 1, 2 or 3 at the first part, you can finish the simulation and see your results.

Do you still think your chance is 50% when two doors left? I am sorry. Run the simulation and try. You are gonna have a hard time believing this.

2021-09-24 14-06-33

Explanation of The Monty Hall Problem

The Monty Hall problem is a brain teaser, in the form of a probability puzzle, loosely based on the American television game show Let's Make a Deal and named after its original host, Monty Hall. The problem was originally posed (and solved) in a letter by Steve Selvin to the American Statistician in 1975. It became famous as a question from reader Craig F. Whitaker's letter quoted in Marilyn vos Savant's "Ask Marilyn" column in Parade magazine in 1990:

Suppose you're on a game show, and you're given the choice of three doors: Behind one door is a car; behind the others, goats. You pick a door, say No. 1, and the host, who knows what's behind the doors, opens another door, say No. 3, which has a goat. He then says to you, "Do you want to pick door No. 2?" Is it to your advantage to switch your choice?

Vos Savant's response was that the contestant should switch to the other door. Under the standard assumptions, contestants who switch have a 2/3 chance of winning the car, while contestants who stick to their initial choice have only a 1/3 chance.

When the player first makes their choice, there is a 2/3 chance that the car is behind one of the doors not chosen. This probability does not change after the host opens one of the unchosen doors. When the host provides information about the 2 unchosen doors (revealing that one of them does not have the car behind it), the 2/3 chance that the car is behind one of the unchosen doors rests on the unchosen and unrevealed door, as opposed to the 1/3 chance that the car is behind the door the contestant chose initially.

The given probabilities depend on specific assumptions about how the host and contestant choose their doors. A key insight is that, under these standard conditions, there is more information about doors 2 and 3 than was available at the beginning of the game when door 1 was chosen by the player: the host's deliberate action adds value to the door he did not choose to eliminate, but not to the one chosen by the contestant originally. Another insight is that switching doors is a different action from choosing between the two remaining doors at random, as the first action uses the previous information and the latter does not. Other possible behaviors of the host than the one described can reveal different additional information, or none at all, and yield different probabilities.

Many readers of vos Savant's column refused to believe switching is beneficial and rejected her explanation. After the problem appeared in Parade, approximately 10,000 readers, including nearly 1,000 with PhDs, wrote to the magazine, most of them calling vos Savant wrong. Even when given explanations, simulations, and formal mathematical proofs, many people still did not accept that switching is the best strategy. Paul ErdΕ‘s, one of the most prolific mathematicians in history, remained unconvinced until he was shown a computer simulation demonstrating vos Savant's predicted result.

The problem is a paradox of the veridical type, because the correct choice (that one should switch doors) is so counterintuitive it can seem absurd, but is nevertheless demonstrably true.

Source of this explanation : Wikipedia Page of Monty Hall Problem

Requirements

  • Python 3

  • Python pip

About

πŸ€ Monty Hall Problem Simulation is a simulation of a math problem. There will be 3 doors. Behind the two doors there will be a goat, behind the one door there will be a car. You will try to choose the car by deciding the door that you want to choose.

License:GNU General Public License v3.0


Languages

Language:Python 100.0%