Fall Semester 2000
Hello and welcome to Monte Hall's Pick-a-door GameShow! You are a contestant in the GameShow, and Monte informs you that there is a Big Prize behind one of three doors and if you pick that door, you win the Prize. Pick a door, any door!
You pick one door and hope that Monte opens it and shows you your Big Prize, but he doesn't. Instead he smiles earnestly at you and says: "Wait. Are you sure? Before you make your final choice, let me show that the prize is NOT behind this other door!" He opens up a second door and reveals that indeed, the prize is not there. Next he points to the third, remaining door and offers: "So do you want to switch your guess from your first choice to this door?" What should you do? Should you switch your guess?
Clear incisive thought can lead you
to the answer. However, forget about that approach. Instead,
write a C++ code to simulate the events just described:
A prize is placed behind one of three doors, you pick one
door at random, the game show host shows you a second door
which does not have a prize behind it, and offers for you
to switch your choice to the third door. Compare the
outcome when you do and do not switch your choice.
Repeat this many times (for definiteness, let "many"=10,000)
to determine whether on average you are better off switching.
To introduce the randomness in these trials, use the functions
myrandomseed(int) and myrandom() that were introduced in Assignment 4
exercise 2.
Call your code monte.cc and have it run exactly like this:
darkstar> monte
where XXXX and YYYY are integers and ZZZ is either yes or no.
Submit your monte.cc source code.
Total number of trials: 10000
Number of times you won the prize by not switching: XXXX
Number of times you won the prize by switching: YYYY
Should you switch? ZZZZ