evang522 / montyhall

A Typescript proof of concept for the classic Monty Hall Problem.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Monty Hall Problem

Imagine you were given a choice of three doors and told one of them had something very valueable behind it, but that the others had nothing.

You begin to open door 1. But then door two is opened and revealed to have had nothing.

Would you continue to choose door 1 for your final answer? Or would you switch your choice to door 3?

According to statisticians, one should always switch to door three.

There are statistical theories that go into the explanation for this, but it's also cooler sometimes to see a practical proof thereof.

This is a proof of concept with software

This program emulates running this same guessing game several thousand times, in which the program makes a choice of one option and then decides to switch the final answer or not.

Once the program is run, the percentage of how often each guessing strategy (switch or don't switch) got the correct answer is calculated and displayed in the console.

Instructions:

  • clone project locally
  • Run npm install
  • Run npm run go
  • Open your console and look at the results.

About

A Typescript proof of concept for the classic Monty Hall Problem.


Languages

Language:TypeScript 70.3%Language:PHP 29.7%