🎯 Learning Objectives
Developing the Programming and Development and Algorithm learning strands, specifically:
- Understand the difference between, and appropriately use if statements when checking doors in your simulation.
- Use variables and relational operators within a loop to govern the end of your Monty Hall Problem game.
- Designs solutions (algorithms) that use repetition and two-way selection i.e. if, then and else.
📝 Document It
- Watch the video.
- Talk with the person next to you about the following questions:
- What is the problem?
- Should you swap, stick with your choice or does it make no difference?
- What is the correct choice? Can you explain why?
📖 Learn It: The Monty Hall Problem
- The Monty Hall Problem is probability puzzle based on an American TV game show “Let’s Make a Deal” and is named after its host, Monty Hall.
- The problem was originally posed (and solved) in a letter by Steve Selvin to the American Statistician in 1975.
- The problem was as follows:
Suppose you're on a game show, and you're given the choice of three doors:
Behind one door is a car; behind the others, goats. You pick a door, say No. 1,
and the host, who knows what's behind the doors, opens another door, say No. 3,
which has a goat. He then says to you, "Do you want to pick door No. 2?"
Is it to your advantage to switch your choice?
- Do you think you should switch your choice or stick with your 1st choice?
- You and most people think they should stick.
- But as the video above video shows contestants who switch have a 2/3 chance of winning the car, while contestants who stick to their initial choice have only a 1/3 chance.
- Paul Erdos, one of the most prolific mathematicians in history, remained unconvinced this was true until he was shown a computer simulation demonstrating the predicted result.
- The image shows the three initial configurations of the game. In two of them, the player wins by switching away from the choice made before a door was opened.
⌨️ Summary – The Monty Hall Problem
Here’s the key points to understanding the Monty Hall problem:
- Two choices are 50-50 when you know nothing about them
- Monty helps us by “filtering” the bad choices on the other side by revealing a goat.
- In general, more information means you re-evaluate your choices.
The fatal flaw in most people’s thinking for the Monty Hall paradox is not taking Monty’s filtering into account, thinking the chances are the same before and after. But the goal isn’t to understand this puzzle — it’s to realize how subsequent actions & information challenge previous decisions. Happy game theory!
I still don’t get it!
Let’s think about other scenarios to cement our understanding:
Your buddy makes a guess
Suppose your friend walks into the game after you’ve picked a door and Monty has revealed a goat — but he doesn’t know the reasoning that Monty used.
He sees two doors and is told to pick one: he has a 50-50 chance! He doesn’t know why one door or the other should be better (but you do). The main confusion is that we think we’re like our buddy — we forget (or don’t realize) the impact of Monty’s filtering.
Monty goes wild
Monty reveals the goat, and then has a seizure. He closes the door and mixes all the prizes, including your door. Does switching help?
No. Monty started to filter but never completed it — you have 3 random choices, just like in the beginning.
Multiple Monty
Monty gives you 6 doors: you pick 1, and he divides the 5 others into a group of 2 and 3. He then removes goats until each group has 1 door remaining. What do you switch to?
The group that originally had 3. It has 3 doors “collapsed” into 1, for 3/6 = 50% chance. Your original guess has 1/6 (16%), and the group that had 2 has a 2/6 = 33% of being right.
⌨️ Code It – The Monty Hall Problem Simulation
- Now it’s time to do our own simulation of the Monty Hall Problem, to prove that you should always switch your choice.
- Your going to comment some code to explain how you can simulate 10000 games of the problem at a time.
- You’ll then see the probability of the two choices of switching and staying.
- Use the below Trinket and tasks to help you complete the Silver badge for this week.
🏅 Badge it
🥈 Silver Badge
- Using the Trinket above you are going to comment on a simulation of the Monty Hall problem to show your understanding of Python.
- Modify the code to add a comment to each line, using a #, indicating what is happening on that line.
- For example, for door = [‘goat’, ‘goat’, ‘car’] you could add # A list called door is created containing the strings goat, goat and car.
🥇 Gold Badge
- Using the code given to you in the Silver badge add print commands to show a visual version of the doors at the beginning of the game.
- Use google to research ASCII art to see how you can use characters to make simple graphics.
- An example output is shown below:
🥉 Platinum Badge
- As we have seen in today’s lesson the Monty Hall problem is unintuitive and hard to get right in your head.
- Your Platinum task is to try to explain using words and pictures why the correct solution is to switch.
- This should be around one page of A4 or a PowerPoint slide in length.
- A Y7 should be able to read your explanation and understand the problem (We will test some of your work!)