Skip to content

NoahCristino/montyhall

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 

Repository files navigation

montyhall

An implementation of the Monty Hall problem. See https://en.wikipedia.org/wiki/Monty_Hall_problem for more info about the problem. The function montyhall can be called with no parameters, so you can play the game, or with params to simulate a game. Below the function I wrote code to simulate a given amount of games according to the settings variables. By default it calls the function 10,000 times starting with a random door, and always switching, then 10,000 times starting with a random door, and staying with the original choice all the time. Then it calculates the percentage, and prints them out. It shows that if you switch there is an average 66% chance of winning, and if you stay a 33% chance of winning. Keep the switchtimes, and staytimes high to make sure you get accurate results.

About

A monty hall simulator with a playable mode

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages