1 SUMMARY For this assignment, you will be writing some code to play the game blackjack....
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
1 SUMMARY For this assignment, you will be writing some code to play the game blackjack. You will write one class, and also a blackjack playing bot that tries to win as many chips as possible. Your summary: 1. Download the starter code and import the project into Eclipse. 2. Implement the DeckStack.java class. 3. Implement the MyBlackjackPlayer.java class. 4. FILES TO DOWNLOAD: blackjack.zip 5. FILES TO SUBMIT: DeckStack.java, MyBlackjackPlayer.java 1.1 DECKSTACK.JAVA Your first task is to implement the DeckStack class. Casinos will sometimes use multiple decks to make cheating harder, and to increase the house odds. For our simulation, we want the dealer to be able to deal cards from a shuffled stack of multiple decks. To simulate this, you 1 // An array of decks of cards that comprise this multi-deck. private Deck [] decks; 3 //Constructor: instantiates the number of decks specified and s //adds them to the list of decks DeckStack (int numDecks); 7 will use the Deck.java class from lecture, but write another class that uses it. This class will be called DeckStack.java and it will contain the following fields / methods: 15 13 //Reshuffles all of the decks. protected void restore Decks (); //Deals the top card from the stack of decks and returns that Card. // You can implement this several ways, as long as it correctly //deals a card from one of the decks. public Card dealTopCard (); //returns the number of cards left to be dealt in the 17 //entire stack of cards. public int cardsLeft (); 12 Once you implement this class, the rest of the blackjack simulator has been written for you and should work. You can run the project and see if the simple player we provided plays blackjack (More detail on the simple player below). 1.2 IMPLEMENT A BLACKJACK PLAYER Your second task is to implement a basic blackjack player. This involves writing two required (and one optional) methods: /* Returns the number of chips you'd like to bet this hand */ 2 public int getBet (); /* Returns the Move this player would like to do right now */ /* Make move is called until the player returns Move.STAY */ public Move getMove (); /* The dealer will call this method to show you their entire */ /* set of cards once the hand is completely over. You may use */ 10/* this information if you'd like. */ public void handover (Card [] dealer Hand); 14 16 /* The Move enum looks like this */ public enum Move { STAY, HIT, DOUBLE; } Your job is thus to implement getBet() and getMove () methods such that you maximize your final chip count after 1000 games (the simulator automatically plays 1000 hands). Your player will begin with 1000 chips. In order to reason about your best move, you can access the fol- lowing variables from within your methods: /* Returns the number of chips the player has */ 2 public int getChips (); * /* A list of the player's cards */ /* Access using this.cards */ protected ArrarList <Card> cards; /* Example of how to see the dealer's face-up card */ this.dealer.getVisible Card (); //returns a Card object Your goal, as stated earlier, is to maximize your profit after 1000 games. Good luck! 1.3 GRADING GUIDELINES Your submission will be graded using the following guidelines: 1. The correctness of your DackStack class. You will get a majority of the credit for this assignment if this class works as intended. 2. Your blackjack player must successfully play blackjack without crashing the simulator or causing other runtime errors / issues. 3. MyBlackjackPlayer.java: Your blackjack player needs to be implemented to apply some reasonable strategy. A grader will glance at your class and make sure you've put in effort to produce a player that is better than random (better than randomly choosing whether to hit or stay, for example). 1 SUMMARY For this assignment, you will be writing some code to play the game blackjack. You will write one class, and also a blackjack playing bot that tries to win as many chips as possible. Your summary: 1. Download the starter code and import the project into Eclipse. 2. Implement the DeckStack.java class. 3. Implement the MyBlackjackPlayer.java class. 4. FILES TO DOWNLOAD: blackjack.zip 5. FILES TO SUBMIT: DeckStack.java, MyBlackjackPlayer.java 1.1 DECKSTACK.JAVA Your first task is to implement the DeckStack class. Casinos will sometimes use multiple decks to make cheating harder, and to increase the house odds. For our simulation, we want the dealer to be able to deal cards from a shuffled stack of multiple decks. To simulate this, you 1 // An array of decks of cards that comprise this multi-deck. private Deck [] decks; 3 //Constructor: instantiates the number of decks specified and s //adds them to the list of decks DeckStack (int numDecks); 7 will use the Deck.java class from lecture, but write another class that uses it. This class will be called DeckStack.java and it will contain the following fields / methods: 15 13 //Reshuffles all of the decks. protected void restore Decks (); //Deals the top card from the stack of decks and returns that Card. // You can implement this several ways, as long as it correctly //deals a card from one of the decks. public Card dealTopCard (); //returns the number of cards left to be dealt in the 17 //entire stack of cards. public int cardsLeft (); 12 Once you implement this class, the rest of the blackjack simulator has been written for you and should work. You can run the project and see if the simple player we provided plays blackjack (More detail on the simple player below). 1.2 IMPLEMENT A BLACKJACK PLAYER Your second task is to implement a basic blackjack player. This involves writing two required (and one optional) methods: /* Returns the number of chips you'd like to bet this hand */ 2 public int getBet (); /* Returns the Move this player would like to do right now */ /* Make move is called until the player returns Move.STAY */ public Move getMove (); /* The dealer will call this method to show you their entire */ /* set of cards once the hand is completely over. You may use */ 10/* this information if you'd like. */ public void handover (Card [] dealer Hand); 14 16 /* The Move enum looks like this */ public enum Move { STAY, HIT, DOUBLE; } Your job is thus to implement getBet() and getMove () methods such that you maximize your final chip count after 1000 games (the simulator automatically plays 1000 hands). Your player will begin with 1000 chips. In order to reason about your best move, you can access the fol- lowing variables from within your methods: /* Returns the number of chips the player has */ 2 public int getChips (); * /* A list of the player's cards */ /* Access using this.cards */ protected ArrarList <Card> cards; /* Example of how to see the dealer's face-up card */ this.dealer.getVisible Card (); //returns a Card object Your goal, as stated earlier, is to maximize your profit after 1000 games. Good luck! 1.3 GRADING GUIDELINES Your submission will be graded using the following guidelines: 1. The correctness of your DackStack class. You will get a majority of the credit for this assignment if this class works as intended. 2. Your blackjack player must successfully play blackjack without crashing the simulator or causing other runtime errors / issues. 3. MyBlackjackPlayer.java: Your blackjack player needs to be implemented to apply some reasonable strategy. A grader will glance at your class and make sure you've put in effort to produce a player that is better than random (better than randomly choosing whether to hit or stay, for example).
Expert Answer:
Answer rating: 100% (QA)
I can provide a complete code example for the given programming assignment Please note th... View the full answer
Related Book For
Statistics The Exploration & Analysis Of Data
ISBN: 9780840058010
7th Edition
Authors: Roxy Peck, Jay L. Devore
Posted Date:
Students also viewed these programming questions
-
Oriole Ltd. had the following transactions in its first month of operations: 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. Issued 18,000 common shares in exchange for $90,000 cash. Took out a $24,900 loan from the...
-
Rosa's employer has instituted a flexible benefits program. Rosa will use the plan to pay for her daughter's dental expenses and other medical expenses that are not covered by health insurance. Rosa...
-
Why is the stopping distance of a truck much shorter than for a train going the same speed?
-
On October 21, 1982, the Bureau of the Mint changed the composition of pennies (see Exercise 120). Instead of an alloy of 95% Cu and 5% Zn by mass, a core of 99.2% Zn and 0.8% Cu with a thin shell of...
-
1. Identify an entrepreneur in your area you would like to interview. 2. Contact the person you have selected and make an appointment. Be sure to explain why you want the appointment and to give a...
-
Hillsborough Co. has an available-for-sale investment in the bonds of Schuyler Corp. with a carrying (and fair) value of $70,000. Hillsborough determined that due to poor economic prospects for...
-
A certain low-loss non-magnetic dielectric material has a relative permittivity (er) of 2.5 and a loss tangent of 0.004. What is the phase constant b of a plane wave of frequency 11.3 GHz?
-
If the Sommers had chosen the original 15-year, 6.25% mortgage proposal, how much tax shelter would they have lost (over the last five years) as compared to the 30-year, 7.25% mortgage?
-
Two sisters, Kristen and Kasey, took different life paths after high school. Kristen the first child, took the path of four year college with a full-time job upon graduation and started saving...
-
Discuss the purposes of conducting performance appraisals from the perspective of a manager and the perspective of an employee. What type of performance appraisals have you experienced as an...
-
Discuss the direct correlation between an effective value chain and a firm's competitive advantage by examining the relationship between: Effective value chain management Customer delight...
-
Discuss the context of the article 'managing virtual teams', the author's purpose, and the style and tone. What is the lesson learned from this early analysis? Explain how a closer analysis of the...
-
Discuss briefly the purpose of having an effective performance management system for the Information officers at UCCI. In your discussion, explain whether or not the performance of the information...
-
Discuss how does a Phase Gate/Stage Gate process mitigate the potential risks in the product development cycle, use a specific example to demonstrate your understanding of the process.
-
Design a Von Neumann architecture computer using simulink State Flow on MATLAB.
-
(a) Use integration by parts to show that (b) If f and g are inverse functions and f' is continuous, prove that (c) In the case where f and t are positive functions and b > a > 0, draw a diagram to...
-
In a study of academic procrastination, the authors of the paper Correlates and Consequences of Behavioral Procrastination (Procrastination, Current Issues and New Directions [2000]) reported that...
-
Researchers at the University of Pennsylvania suggest that a nasal spray derived from pheromones (chemicals emitted by animals when they are trying to attract a mate) may be beneficial in relieving...
-
When n is large, the statistic s is approximately unbiased for estimating s and has approximately a normal distribution. The standard deviation of this statistic when the population distribution is...
-
______________ occur(s) when the speaker should pause but instead fills the silence (umm, ahh).
-
Identify an election (federal, state, or local) for which a debate was broadcast. Analyze how the different speakers were able to adapt their messages based on the moderators questions and their...
-
___________ refers to your credibility as a presenter as well as the credibility of the information delivered in your presentation.
Study smarter with the SolutionInn App