Monty Hall SimulationYP

by yoonha.park
See Code Download Embed
Yoonha Park

Bonus features: host, sounds (intro, clapping for winning, losing, goat, winning), confetti for winning, animation of doors, switching of grand prizes at random (options: a big pot of gold, a Tesla Model X, or 2 tickets to Hawaii), and two different graph options (one for just the number of repeated iterations from key "A" and the other based on how many wins you get from playing with the host)

Tested with classmates Audrey Jacobs, James Hsu, Maggie Lau, and Anna Aldrin. 

When the green flag is pressed, the game "Let's Make a Deal" will play with all the sounds and animations.

When the space key is pressed, you can replay. 

When r key is pressed, the wins and losses are reset to 0.

When b key is pressed, after having graphed, the sprites will show again.

When g is pressed, a graph of the percentage of wins for switching and not switching will appear. This only tells you the percentages based off of the data from the number of iterations you wanted it to do. For example, if you do 100 iterations, it will do 100 iterations of switching and 100 interations for staying, and graph independently the percentages of winning for switching and staying. THe two bar graphs are independent of each other.

When h is pressed, a graph of the percentage of wins you get from switching and the wins from staying are shown, based off of only the data from playing with the host. Therefore, if you have not played yet and won, you will get a blank graph with no bars shown. The two bar graphs are dependent of one another, so they should add up to approximately 100% (considering that the values may be rounded up). 

When a is pressed, how many iterations of repeating the game with switches and not switches will be asked. Then, it will have a percentage of wins for switching and not switching. Then, you can graph the results by pressing g. 
 

Created March 31, 2020

Last updated April 26, 2020

Published April 4, 2020