4 ms·
Show HN: The Monty Hall Problem in JavaScript
- atum47 6y agoMore information about the project here https://github.com/victorqribeiro/montyhall https://github.com/victorqribeiro/montyhall
- tombert 6y agoAh, the good ol' Monty Hall problem...this problem (and .999...=1) have caused a ton of arguments between me and my not-quite-as-mathematical friends. I guess the fact that it's statically better to switch is definitely a tough pill to swallow.
- freefriedrice 6y agoI remember reading this in Parade Magazine when Marilyn Vos Savant published her column. And then was completely blown away by the landslide of scathing letters written by adult professors at colleges belittling her for being so dumb. And they were wrong. Truly amazing demonstration of how bias (and the limbic system) work against rational thought. Here is a link with some hilarious quotes from livid professors saying dumb shit: https://priceonomics.com/the-time-everyone-corrected-the-worlds-smartest/ https://priceonomics.com/the-time-everyone-corrected-the-wor...
- abiogenesis 6y agoThis letter explains why we are in trouble: You made a mistake, but look at the positive side. If all those Ph.D.’s were wrong, the country would be in some very serious trouble. Everett Harman, Ph.D. U.S. Army Research Institute
- atum47 6y agoyeas, I wrote this code at least 10 years ago because I didn't believed statistics. I had to see for my self. It was a great exercise for both areas, code and probability.
- jancsika 6y agoOne thing that helps IMO here is to exaggerate the problem: Start with one million doors. Choose one. Now have Monty open 999,998 of them. Do you switch doors? I believe it works because the chooser is forced to reckon with the 1 in a million chance that they chose the correct door. Additionally, it becomes clear that Monty actually fed the chooser new information by opening 999,998 doors. It may not take the first time, but given a few rounds of the million door challenge both truths should sink in for the chooser. Perhaps it would help to have a Javascript version that starts with a sufficiently large number of doors the first round, then cuts that in half each round until you get down to 3. The odds of winning decrease each time but the principle should still hold. (Although I can imagine some people getting back down to three doors and suddenly reverting back to their previously held intuition...)
- systemBuilder 6y agoMost people mistakenly think Monty chooses randomly. He doesn't.
- wyattpeak 6y agoIt's a common error, but I don't know if it's most in my experience. I've seen plenty of people fully understand the problem (for some value of fully understand) and insist it doesn't matter whether or not you switch.
- karanke 6y agoI've won 100% of the time by switching and then not switching doors, surely that can't be right?
- atum47 6y agohow many times did you play?
- Skunkleton 6y agoI played ~20 times, and won ~2/3s of the time as expected.
- abiogenesis 6y agoBuy a lottery ticket.
- hackerman123469 6y agoSame by not switching I've had 100% success with like 20 rounds.
- madrox 6y agoWhen I got my statistics degree, a significant amount of time was spent in early classes demonstrating how non-intuitive statistical thinking can be. This, of course, is probably the most memorable example. Another fun one was a TED talk about Peter Donnelly on how juries get fooled that included a bunch of similar examples: https://www.ted.com/talks/peter_donnelly_how_juries_are_fooled_by_statistics?language=en https://www.ted.com/talks/peter_donnelly_how_juries_are_fool...
- atum47 6y agowell, I made this experiment cause I didn't believed that you would have more chance switching doors. Couldn't wrap my head around the idea...
- madrox 6y agoTotally! Simulation is a great way of learning this stuff. I spent a lot of time in R doing similar things over the years.
- Frost1x 6y agoThe Monty Hall problem supposedly even confused Paul Erdos (famous mathematician) who even rejected it after given a statistical proof. He didn't accept the answer until stepping through a computer simulation so if it seems unintuitive, you're in good company. This problem is, in lore, claimed to trip up more nobel laureates then most problems because it's so counter intuitive to not notice the conditional probability and injected information from Monty.
- atum47 6y agothat's really interesting
- abiogenesis 6y agoTry increasing the number of doors and your brain will (slowly) accept it. "One million doors" as described in another comment [1] is a good way to visualise it. [1] https://news.ycombinator.com/item?id=23161993 https://news.ycombinator.com/item?id=23161993
- newtoday 6y agoTypo: Times you didn't swicht doors: 2
- deleted 6y ago[deleted]
- s9w 6y agoSome constructive feedback: - The language randomly seems to switch to something else ("porta") - Even if you're faintly familiar with the problem (like me), it's hard to gauge the actual goal of the game. For example I didn't recall if a door being empty is good or not. - The coloring seems not very helpful. Red for the chosen door? Red is usually associated with something bad. And the colors for opened and still closed doors are not easily associated with their state. A simple bitmap or even a text would say much more than those colors. - The statistics give a lot of numbers that aren't meaningful, and don't show the meaningful ones. In particular the absolute counts of how often was switched are hardly of importance. It's about the ratio of correct decisions - in particular that number should be split into switching and not switching decisions.
- mping 6y agoPorta mesma door in Portuguese. Author is probably pt/pt or pt/br
- atum47 6y agoyes I am pt/br
- atum47 6y agoyeah, this is one of my earliest code in life. I made sure to kept it close to original as possible, I did translate it to English, must have missed one word. thank you for the feedback