Question
Objective: You will create a text based light version of the game show Deal or No Deal? Show synopsis: In the game show, contestants pick
Objective: You will create a text based light version of the game show Deal or No Deal?
Show synopsis: In the game show, contestants pick a case out of 26 total cases, each of which contains a different dollar amount printed inside. The dollar amount represents how much the contestant can win at the end of the game if they make no deals throughout the show. The amounts in the cases are random, and the contestant has no idea which case has what amount. Throughout the show, contestants pick out the other cases they did not originally pick one by one, and the dollar amount inside those cases is revealed. Periodically, the banker, a behind the scenes person on the show, will come up with a dollar amount they will give the contestant on the spot to make a deal if the contestant chooses not to continue. This is largely based upon which values have been revealed in the cases chosen. In other words, if several small cash amounts have been revealed, it is more likely the contestants original chosen case contains a large value, so the bank will make a larger cash offer for a deal. This continues until the contestant makes a deal or decided to not make any deals and is ultimately given what is in their original case.
Gameplay Requirements: Your version of Deal or No Deal will be reduced in complexity. Your game needs to meet the following requirements:
- The user (contestant) will choose from 10 total cases rather than 26
- Each case will contain the dollar amounts: 1, 100, 500, 1000, 10000, 25000, 100000, 250000, 500000, 1000000
- See the end of this document for code on how to create the dictionary with these amounts randomized
- The user (contestant) will initially choose one of the cases, 1-10, as her/his case
- That case will be set aside for use later
- As the game progresses, the user will choose additional cases in order to reveal the contained amounts
- The user should not be able to choose the same case more than once
- Periodically, the game (the banker) will offer the user a deal
- This should be done after the third guess, fifth guess, seventh guess, and the eighth and final guess
- There are only eight guesses because the user removes his/her case right off the bat leaving nine cases and choosing the ninth case is pointless because it would automatically reveal whats in the contestants case due to process of elimination, making a deal irrelevant
- The deal amount should be very simply determined: The total of all cases added together leaving out the 1 (1,886,600) MINUS the amounts revealed so far DIVIDED by the total amount of cases left INCLUDING the case the contestant chose. Round this to the nearest number using the round() function
- g. If a user chose 3 cases so far with the values of 500, 25000, and 250000, the offer would be (1,886,600 275,500) / 7 = 230,157
- This should be done after the third guess, fifth guess, seventh guess, and the eighth and final guess
- Winning (game ending) conditions:
- The user takes a deal
- The game should end, and the user is congratulated for winning the deal amount
- Also let the user know what she or he could have won by revealing the amount in her/his case
- The user does not ever take a deal
- The game ends
- In the case of no deal being made on the final deal, reveal what is in the ninth and final case the contestant didnt choose as well as what is in his/her case i.e. the amount he or she won
- Congratulate the user on winning the amount in his/her case
- Consider making use cases where the message to the user changes depending on how much she or he won
- The user takes a deal
Coding Suggestions / Hints:
- Your life will be much easier if you use a dictionary to store the cases and their values rather than try to use a list; again, the code to create this dictionary is at the end of the document
- Your instructor would probably use a loop to go through the game for each case; there are several ways to do this
- Make sure that the loop is broken if any of the game ending scenarios become true so the game ends properly
- Your instructor strongly suggests putting as much repetitive code into functions as possible
import random amount_list = [1, 100, 500, 1000, 10000, 25000, 100000, 250000, 500000, 1000000] random.shuffle(amount_list) cases_values = {} i = 0 for amount in amount_list: i += 1 cases_values['case_'+str(i)] = amount
# Obviously you don't want this to print in your final game -- these prints # are to show you what the result looks like # as well as how to call up a specific case's value # I made the key values distinct and easy to remember # They are 'case_1' through 'case_10' # Note that the names are all lower case and there is an underscore print(cases_values) print(cases_values['case_1']) |
Code to create a dictionary of the 10 cases with shuffled values:
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started