Monty Hall
Unit 3 Bonus Project
In this project, you will create a playable version of what is known as the ‘Monty Hall’ game. This was an actual game that was played on the 1970’s game show Let’s Make a Deal, hosted by Monty Hall:
This game is played as follows: there are three doors, labeled Door 1, Door 2 and Door 3. Behind two of the doors (random), there are goats (or some non desireable prize) and the third door hides a car. The player will first click on one door to select it. Before the door is opened to reveal what’s behind it, the host will open a different door to reveal a goat (there is always at least one goat the player did not pick that can be revealed), and ask the player if they want to switch to the remaining unopened door, or stick with there original choice.
Once the player makes this choice, the door they ultimately chose will be opened and they will see if they won a goat or a car.
With your partner discuss the steps required to make this program work. Divide it into several stages of development and identify what techniques you could use for each part (i.e. lists, clones, broadcasts, specific blocks).
Write a Snap! program to generate the design.
Click for a suggestion of how to organize the different stages of the program.
- Doors appear (Green flag script creates clones)
- Use clicks on one door (when I am clicked script selects door, triggers host action)
- Different door is opened - one with a goat behind it (how to figure out which door to open? What script should determine which door is opened?)
- Host asks user if they want to swtich or not (ask block with options list)
- Host opens door the user chose (original or switched door) and announces what they won.
Click for more details about how to organize your program!
- Make the doors as clones of the ‘door’ sprite. They should each know their door number - how can each clone keep track of its door number? (remember how the squares in tic tac toe were identified?)
- What happens to each door when it is clicked on? Use a graphic effect such as ‘negative’ to change the way it looks in order to give feedback to the user. What do you want to happen next? What script should be triggered and how do you want to trigger it?
- What if the use clicks another door? Should they be allowed to?
- How does the program know which door has the car behind it? Do the door clones need to keep track of this information or can it be kept track of centrally (with a global variable)?
- Once you’ve answered that question, how do you determine which door the host should open up for step (3) above? One idea, use a keep block in conjunction with an item random of block.
- Can you abstract the operation of opening a door? Hint - use a broadcast with data, where the data is the door number to be opened. Each clone has a ‘when I receive’ script that starts with a conditional checking if the value of data matches the door’s ID number.
- Add global variables to keep track of how many times the player has won the car.
- Keep track of the percentage of wins when the player chooses to switch vs. when they choose to stay
Eventually you will use the program with these extensions to run simulations that will help reveal the fascinating mathematics behind this game.