Coding Challenge 170: The Monty Hall Problem

preview_player
Показать описание


GitHub Repo and Demo:

Links discussed in this video:

Other videos mentioned in this video:

Timestamps:
0:00 What is the Monty Hall Problem?
1:50 Solution for Monty Hall Problem!
6:55 Starting the Code
8:53 Centering a DIV
10:22 Callback Events
15:40 Refactoring into Functions
23:11 Adding Stats
27:04 Playing the game!
28:21 Bayes Theorem
31:45 Goodbye!

Editing by Mathieu Blanchette
Animations by Jason Heglund
Images licensed by Getty Images
Music from Epidemic Sound

Рекомендации по теме
Комментарии
Автор

Here’s how I finally intuitively understood the problem. If your initial guess is correct, then switching loses. If your initial guess is wrong, then switching wins. What are the odds your initial guess is wrong? 2/3. That means when your initial guess is wrong, 2/3 times, switching wins. Switching means you win 2/3 times.

zarblitz
Автор

Everyone’s assuming you want the prize more than the goat.

Tentin.Quarantino
Автор

I've watched tons of videos about this, but that explanation "Would you like 1 door, or 2 doors?" is the simplest description I've ever heard! That's awesome!

veggiet
Автор

Just finished a hard day at work and it's weekend time so I set out to watch some recreational content but I have been watching this coding video for the past 30 minutes. There's something very positive about the vibes you exude which makes coding seem more fun than entertainment videos.

priyanshusingh
Автор

My favourite way of thinking about this is that you have a 1/3 chance of picking the winning door at the start. This means that there is a 2/3 chance that the prize behind one of the two other doors. Because the reveal must be a losing door from the two you didn't pick, that means the remaining unpicked door has the full 2/3 chance of winning.

philrod
Автор

To me the easiest way to intuitively get this is to dumb down the question to an extreme.

Host: Pick one of the three doors

You: This one.

Host: Do you want to have both of the other doors instead?

You: Umm... yes?

Host: But what if I told you that you can have these two doors, but one of them is a goat.

You: I already know that. There are three doors, only one has a prize, you are offering me two doors, I already know at least one is a goat.

Host: No but seriously one of these two doors is a goat, do you want your one door or my two doors.

You: I want your two doors.

Host: You don't understand, one of these two doors are a goat... See **opens one of the doors to show a goat**

You: I already knew one of the doors was a goat, this doesn't change anything. I'll take your two doors please.

JonathanChute
Автор

I feel lucky i watched the twitch live behind the scenes! Dan is really doing a great job, also a very fun, patient and awesome teacher!

thatsnuts
Автор

Coding train explaining The Monty Hall Problem better than both my math teachers and math youtubers. Impressive

antond
Автор

This man is literally doing lectures that we enjoy.

exoticlol
Автор

This was great. 😀 I remember when the problem first appeared in Parade magazine back in 1990, and reading the flood of responses, many claiming vehemently that Marilyn was wrong. But she refuted them all, and I remember the 100-door example she used to demonstrate her point. Fun problem.

kenhaley
Автор

As I’ve been watching this, I realize you’re telling a story. Then I thought how neat it would be to write a story about JavaScript/ECMAScript written in English. And as you progress through the story, you introduce JS concepts piece by piece and finally at the end of the story, most of it is in JS. If anyone could pull this off, it would be you, Dan.

InsectInPixel
Автор

I've always struggled about the intuition behind this, and at 5:08 I finally got it!

beantown_billy
Автор

I just came in cold to your channel and completely by chance. Watched the whole thing. LOVED IT. You have a gift for teaching, what a stunning video. Gonna have to check out your body of work now, and I'm so glad to have found you! Nice one :)

RCTNT
Автор

I love that you don't plan these out in detail before. It really let's us see your thought process as you code. You are such a gift to humanity.

Sam-byuk
Автор

you’ve just made a better and more coherent argument for switching then pretty much anyone i talked to. i never really got why so many people thought that and u just solved a years old question for me in a few seconds. you’re pretty good at this

idanmenaged
Автор

You are a very big teacher. You are teaching people something more than just a goat or cat. Thanks

aydinjalalvandi
Автор

I kinda got an intuitive sense for this by just thinking that if you always switch then you only lose if you guess the right door. There's a 1/3 chance you guess right, so you lose 1/3 of the time, which is equivalent to winning 2/3s of the time. Now that's the maths, but we all know that getting a goat would be a pretty cool prize so chances of winning at this game are 100%.

avananana
Автор

Omg you finally helped me understand the problem! I've watched so many videos before but I always gave up because it didn't make sense to me but now it does!!

zwampel
Автор

You did a better job of explaining Bayes Therom in about 20 seconds than my college professor for stats did over 3 days. To be fair they were talking about other things that are a bit more complex also in terms of probability, but I get it now.

deathone
Автор

A very intuitive explanation:
If you pick the wrong door initially, you always win by switching. Think about it.
As picking the wrong door is more likely, you should always switch.

shaileshrana