Project One
Due 7 May
Intro:
You are going to write a program to play a round of "Let's Make a deal". By 11:59pm on the night the assignment is due, I want the source code emailed to me. You will also need to answer the following question. Place the answer in a comment in your source code at the top. Also place your name at the top of the source file.
Run the program 20 times, always opting to swap doors. Run the program 20 times always opting to keep doors. What strategy seems to be the best.
LETS MAKE A DEAL:
This is how "Lets Make A Deal" is played.
First of all, there are three doors. Randomly, behind one door, there is a good prize. The other two doors contain bad prizes. The technical term for a bad prize is "booby prize". The contestant, or user, is asked to choose door number 1, 2 or 3.
Then, the user is shown one of the booby prize doors. Here, there are two cases. If the user selected the good door the first time, then one of the other two remaining booby prize doors are opened randomly. If the user selected a booby prize door, then the other booby prize door is opened. The user must be shown the number of the door that is opened.
Now we have two closed doors. One that was chosen by the user, and the one that was not opened. The user is then asked if he/she would like to switch doors. Again, the user must be show what door they have and what door they can switch to.
Finally, the user's door is opened, either revealing a good prize or a
booby prize.
Sample Output
Here is the results of running my solution several times.
Yours does not need to look exactly like this, but something like it.
Welcome to LETS MAKE A DEAL!!
Which door do you want to choose?
Door number 1, 2 or 3?
2
Behind door 1 is a Booby prize!
You have chosen door 2
Do you wish to switch to door 3 ?
Enter 1 for yes, and zero otherwise
1
Your final choice is door 3
The good prize is located behind door 2
Ach, you got the Booby prize!
Welcome to LETS MAKE A DEAL!!
Which door do you want to choose?
Door number 1, 2 or 3?
1
Behind door 3 is a Booby prize!
You have chosen door 1
Do you wish to switch to door 2 ?
Enter 1 for yes, and zero otherwise
0
Your final choice is door 1
The good prize is located behind door 1
Congratulations! You won!
Welcome to LETS MAKE A DEAL!!
Which door do you want to choose?
Door number 1, 2 or 3?
2
Behind door 1 is a Booby prize!
You have chosen door 2
Do you wish to switch to door 3 ?
Enter 1 for yes, and zero otherwise
0
Your final choice is door 2
The good prize is located behind door 3
Ach, you got the Booby prize!
Hints and Tips
- PLAN AHEAD. Design your program before you even think about starting, or you will definitely run into problems. This program has got a bit of messy logic in it, and not thinking it through ahead of time is a great way to get lost.
- In your planning, you may make your life easier by deciding on a few variables and explaining how at each step of the way these variables change.
- For example, I used to the following integers... users_door ( the door the user has selected )., good_door ( the randomly chosen door that has the good prize behind it ), open_door ( the booby prize door opened for the user ) and other_door ( the door that is not revealed to the user is the not the door selected by the user initially ). Figuring out the values of these variables as you move through your program should help you out.
- START EARLY
Extra Credit:
Extra credit is available for extra effort. Some thoughts include:
- Randomly printing out a set of booby prizes and good prizes
- Allowing the user to play the game over AND over again without having to restart the program.
- Using functions.
- Writing the program such that the user has the option of playing normally, or playing a few thousand rounds automatically.
Grading Criteria
This program is worth 75 points. The largest amount of points a non compiling program can earn is 25 points. From this total, 2 points per error will be deducted until no more errors are found or there are no points left.
Style is very important. All variables should have useful names, all lines of code should be indented, and there should be comments about once every 5-10 lines. Each violation is subject to a 2 point deduction to a maximum of 26 points.
For each functionality listed above that is not completed, a maximum 8 point penalty will apply.