September 18th, 2008

Monty Hall problem, by brute force.

Ever heard of the Monty Hall Problem? If not, go here for some supplemental reading

Here's a little script that plays the game a hundred times using the "switch" strategy, and reveals the number of times the player wins or loses - showing that you are more likely to win if you "switch". For more accurate averages, change the loop condition to a number higher than 100. Running this game with 10000 iterations, the average converges on 2:1 odds.

Enjoy!

Filed under Uncategorized

Leave a Reply