Monty Hall project

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?
This is the Monty Hall problem!

Wikipedia

Monty Hall problem - Wikipedia

Inspiration

(Coding Challenge 170: The Monty Hall Problem - YouTube)

After several tries, there is a trend:
image

Project

Oh, and you can adjust the speed of the senario.

Did you forget to link to the actual project?

To anybody that doesn't understand the probability:
What if you picked a door and kept it the entire time? The host opening another door does not change the probability, so you have a 1/3 chance of picking the car. There is a 2/3 chance that you pick either goat, the other goat is revealed, and you should switch to get the car.

I think this part of the argument isn't obvious. Events can change probabilities; suppose you're tossing a coin, and your a priori assumption is that it's a fair coin, so 50% probability for each side. Then you learn that the person who provided the coin has a history of cheating in games of probability. Now you decide, correctly, based on the new information, that one side is much more likely than the other.

Why doesn't the same reasoning apply to the Monty Hall problem? The answer depends critically on the fact that Monty knows where the car is. If he randomly opened one of the doors that you didn't choose, then the probability that your door has the car would be 1/2, which is the intuitive answer.

As it is, this is a problem in conditional probabilities, i.e., what is the probability of A given that B is true? This is written P(A|B). In this problem, as is often the case, we know things like P(Monty opens door #2|Car is behind #1) assuming without loss of generality that you chose #1. What we want to know is the opposite: P(Car is behind #1|Monty opens #2). Conditional probability isn't commutative; these two conditional probabilities generally aren't equal. To find P(B|A) given P(A|B), we use Bayes' Theorem. Here's a more-readable-than-Wikipedia explanation of how that works out for Monty Hall.

Yesterday, when I saved this message, the forum crashed at the same time (for several hours)... Sorry for the inconvenience.

Here is version 1.

Version 2 will incorporate "Auto Keep" and "Auto Switch" functionality

Say the host just opens the contestant's chosen door; 1/3 chance that the car is chosen. Now, what if the host opened another door first? I don't think it matters because the contestant already has a door chosen.

Lol I guessed all of them correct

I think there's a bug, for me the goats and car are rendered in front of the doors...

i will take a look on this, thk
(it's too easy to choose if you see goats and car hahaha)

No bug here...

Just to be sure, the normal way is:

  1. all doors are closed: you see nothing (no goat/no car)
  2. you choose a door
  3. Monty show you a goat (you see a goat/no car)
  4. you can keep or switch
  5. you win or lose : all doors open: you see 2 goat and the car

What is your browser?

Chrome...

i will test it on chrome... one moment...

You are right, it's a browser issue... no problem in firefox!

dang :frowning:

can you try it plz

I'm on a school chromebook, I have no other browsers

test it again in chrome... i found something wrong in the code...

If you have time, can you test it on chrome plz

ill test it

it works fine now