Skip to content

The readme file for the monty hall problem. This program runs 100k+ tests of the monty hall game. Each round has a player that randomly chooses an initial door. We then track his outcome if he keeps his original door or changes to the door left by the host. Both winning percentages are reported.

Notifications You must be signed in to change notification settings

JessRudder/MontyHall

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 

Repository files navigation

MontyHall

Monty Hall was the host of a game called "Let's Make a Deal". In the game, the contestant was given the choice of 3 doors. Behind one there was a prize. Behind the other two were worthless gags. Once the player has chosen their door, the host eliminates one of the remaining doors. He cannot eliminate a door with the prize. The contestant is then given the choice of sticking with his door or changing his mind and selecting the remaining door.

A probability brain teaser was based off of the game. The question is whether a player's chance of winning is better, worse, or the same if they always change their mind and go with the remaining door that wasn't eliminated (instead of their original choice). For more information you can read the wiki article on the Monty Hall Problem.

This program allows you to run 1 or more game scenarios to see if a player does better by sticking with his initial choice or changing his mind. The number of scenarios can be chosen by setting the testRounds variable.

Each round starts with a random door being chosen. The same choice is assigned to the Stays player and the Changes player. We then track his outcome if he keeps his original door or changes to the door left by the host. Both winning percentages are reported.

This is the first program I've written in Ruby (outside of guided homework assignments on Codecademy). The code works, but, it's rather rough. I will be cleaning it up as I have time.

About

The readme file for the monty hall problem. This program runs 100k+ tests of the monty hall game. Each round has a player that randomly chooses an initial door. We then track his outcome if he keeps his original door or changes to the door left by the host. Both winning percentages are reported.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages