Question

In: Computer Science

Deal or No Deal Assignment Have you watched the gameshow Deal or No Deal? We are...

Deal or No Deal
Assignment
Have you watched the gameshow Deal or No Deal? We are going to design a smaller version of it.
Parameters
•   We’ll have 25 differing dollar amounts from $1 to $1,000,000. (Let’s use 25, not 26; drop the 1 cent value in the original game values.) Each dollar amount is randomly placed in one of 25 briefcases, and none of the game players know the locations.
•   We’ll only implement 1 Round with 4 states:   
1.   Player makes guess of Prize briefcase
2.   Player opens N other briefcases
3.   Banker makes an offer to buy back Prize briefcase
4.   Player responds – and wins or looses   
Board Presentation
Show the 25 briefcases as a 5x5 grid. (You can hardcode the 25 and 5x5 – these parameters don’t change.) Each cell of the grid represents a briefcase. The contents of the cell can display 1 of 2 things: either a closed briefcase or an opened briefcase. If closed, then just show the briefcase number; if opened then display the dollar amount inside.   

Also show the remaining Cash Values still in play. I used a 2-row table where the values opened have a grey background. The other values are in the closed briefcases and one is the Prize Briefcase.
  
      
Rules of Play
There are 2 participants: The Player and The Banker. The Player wants to make as much money as possible, and The Banker wants to keep as much money as possible.
We’ll only do 1 Round. So, we’ll have 4 steps or 4 States to our game.
1.   Initialize: This is the setup for the board and initializing the State Variables (hiddens).
2.   Prize Briefcase selection: The player first picks their prize briefcase. In the picture above, the player selected Case #17. That selection must be stored in a State Variable for the entire game – so the game can “remember” it. (The dollar amount contents of the Prize Briefcase is not displayed, of course, so keep the case “closed.”)
3.   Open N other briefcases: Now the player picks N other briefcases to open. For our miniature game with only one round, N=6. After the user selects 6 briefcases, they are opened and the dollar contents displayed to everyone.
4.   Accept or reject The Offer from the Banker: The game pauses. The Banker now makes an offer by buy back the Prize Briefcase from the player –with unknown contents to all. The Banker doesn’t know contents of the Prize Briefcase but doesn’t want it to be big. So, the Banker offers a price somewhere in the middle of the range of the remaining dollar amounts.   

The Player can accept or reject the offer from The Banker. In our game, either way, this is the end of the game. In the real game, if the offer is not selected, then the next round continues with N=N-1 briefcases opened until there is only 2 left.   
State Variables
I had 3 State Variables.
•   $state – this is an integer. It goes from 0 to 3.
•   $caseCash – this is a 1-D array of length 25. Each cell is a briefcase. The value of the array is the cash in the briefcase.
•   $caseState – this is also a 1-D array of length 25. Each cell is a briefcase. The value is a string representing the status of the briefcase. There are 3 options: closed, opened, or the 1 Prize Briefcase. In my game:
o   A dot ‘.’means the briefcase is closed. o An ‘o’ means that the briefcase is opened.
o   The string ‘prize’ means that The Player has selected that briefcase for their prize at the end.

The Banker
The job of The Banker is to “save” money. He knows The Player will get the cash in the Prize Briefcase. The Banker’s job is to “buy” the Briefcase back from The Player, hopefully for less money than is in the Prize Briefcase. Neither party know the contents of the Prize Briefcase, so both parties are gambling.
A very simple algorithm for The Banker is simply to take the average() of all the unopened, remaining briefcases. The Average will be right in the middle. That makes it a 50% chance that The Banker does better and a 50% chance that The Player does better. You are free to make The Offer using any function you want. Have fun.   

Solutions

Expert Solution

OUTPUT


Related Solutions

Individual Assignment #4: We have covered a great deal of ground and information between the last...
Individual Assignment #4: We have covered a great deal of ground and information between the last assignment and this assignment. I would like you to focus your time on two on the most forgotten areas of training and development. Those two areas include analysis and evaluation. 1. Define the term needs analysis and evaluation 2.Describe the components of a needs analysis 3.Explain how you would conduct a needs analysis at BP Amoco 4.Describe the levels of evaluation and which ones...
We have all watched someone perform either in a sports competition, a musical performance, a presentation...
We have all watched someone perform either in a sports competition, a musical performance, a presentation or speech, or any kind of contest. Write a cause-and-effect essay that explains how a person's ability and other factors shape how he or she performs?
In this activity we have graphed the function y = sin(x). For this assignment, you will...
In this activity we have graphed the function y = sin(x). For this assignment, you will explore the changes that occur in the curve when we make simple changes to the function. For each of the different parts below, create sketches and a description of the crucial properties of the periodic graphs including: Period Amplitude Maximum Minimum Axis of the Curve Zeros Finally, in a few sentences, based on your findings describe how these changes in the function affect the...
In this assignment, you are asked to begin to pull together the marketing concepts we have...
In this assignment, you are asked to begin to pull together the marketing concepts we have been discussing and to think ahead. Entrepeneurship is really a concept of evolution, an idea that often begins as a small business. Before it became Walmart was we know it, Sam Walton's store began in a small town in Arkansas. A similar history exists for McDonald's -- a small hamburger stand in California. In the auto industry, the Dodge Brothers really did exist. Look...
WE ARE USING PYTHON TO COMPLETE THIS ASSIGNMENT :) THANK YOU! In this programming assignment, you...
WE ARE USING PYTHON TO COMPLETE THIS ASSIGNMENT :) THANK YOU! In this programming assignment, you will write functions to encrypt and decrypt messages using simple substitution ciphers. Your solution MUST include: a function called encode that takes two parameters: key, a 26-character long string that identifies the ciphertext mapping for each letter of the alphabet, in order; plaintext, a string of unspecified length that represents the message to be encoded. encode will return a string representing the ciphertext. a...
We have learned a great deal about the history of exposure to environmental toxins in the...
We have learned a great deal about the history of exposure to environmental toxins in the twentieth century - from lead in paint and gas, occupational exposures to toxins, to air pollution, to Love Canal. Choose three of these cases and analyze them comparatively in terms of causes, responses, and lessons for ongoing environmental health challenges. answer in few paragraphs
Suppose that the longevity (or life span) of mammals is something we have a good deal...
Suppose that the longevity (or life span) of mammals is something we have a good deal of information about and typically understand well, but the gestation period (or the length of pregnancy) of mammals is less clear. We therefore want to think about how we might be able to predict or explain gestation period based on longevity, especially if we uncover a new species of mammal. The scatterplot below shows the relationship between longevity (measured in years) and gestation (measured...
Have you ever watched the way the bread company puts bread on the shelf in the...
Have you ever watched the way the bread company puts bread on the shelf in the grocery store? The freshest product is always placed in the back of the shelf. What type of product movement would this be? LIFO, FIFO, something else? How do firms decide on their choice of merchandise accounting method? Does it have to match the way they move items out of the building?
In this SLP assignment, we will get more practice with the concepts we have learned. Read...
In this SLP assignment, we will get more practice with the concepts we have learned. Read the following requirements, first write pseudo code based on your understanding, and then develop a Java application program based on your pseudo code. The program will first ask users to key in their taxable annual income. Depending on the income level, the program will calculate the tax owed. Using the following table as reference: Income tax bracket percentage: 0–$8,500: 10% $8,500–$34,500: 15% $34,500–$83,600: 25%...
how do we deal with medication compliance?
how do we deal with medication compliance?
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT