Question: In java 8.0 or greater thanks 24 Game (20 marks) The class Game implements the logic of the single player game of Rumany. . An

 In java 8.0 or greater thanks 24 Game (20 marks) The

In java 8.0 or greater thanks

24 Game (20 marks) The class Game implements the logic of the single player game of Rumany. . An object of the elass Game has two decks of cards, one is the main deck, whereas the second cne repeesents the player's The elass declares one coestructor. This comstructor has one parameser, which specifies the number of anks for this A Game object has only one publie instance method, which is called play. The method implements the logie od the hand. An object of the class Game also has a die (reference to an object of the class Die). game. When a Game object is created, it also creates the main deck and the die. ame Here is a description of the game: .Step O. The strange deck is created and shuffled. (In order to test your game more quickly you can reduce the number of Top of ranks to less than 13 and more than 3). In your implementation, the created deck is an object of the class Deck. the deck is considered the last card. . Step I. The player is dealt 7 cards from the top of the strange deck . Step 2 The following steps are repeated until the player runs out of the eards ie until the player's hand is empty: -The player rolls a die: . If the player pets a 1 The player can discard any one card she likes. Afier that, the current round is over and the game goes back to Step 2 If inslead the player gets 2, 3.4,5or6 The player is first delt, from the top of the deck, a namber of cards ooeresponding to the valoe of the die, or size of the deck of cards, whichever Es smaller The player then keeps on discarding melds from her hand until she has no more melds. You program has to check that the set of cards that the player chooses indeed foems a valid meld before discarding them from the player's hand Once she decides she is out of melds the round is over and the game goes back to Step 2 Finally,once the player is out of cards fie, once the player's hand is empty), the total number of rounds is reported and the game is over Noe that if the deck is empty and the player has no more melds, Bo melds can ever be created again. Thus the player has to wait for 1 on the die. In order to avoid that frustratiom, y am empty deck should rol i set num to 1, in each round that starts with As usal, whenever you ask the player for some input you should make sure they give you the required kind of input. You may assume that the player will folow instructions and give you a correct type of data. but not the correct values. For example. if you are asking tor an integer between 3 and 99, you may assume that the player will give you an integer, but not that she will give you an integer in the correct range. Thus you should keep on repeating the question until you pet a valid answer. Similary if you ask the player for a meld, you may assume that the player will give you a set of 3 cards, but you will need to test if these cards are indeed in the player's hand and that they form a meld. We provide you with several methods to help you with this part of the assignment. See 02/Utils java 2.5 Rurn We provide you with a class called Run. It contains the main method for this application. 2.6 Test We provide you with a class called Test. It contains a small number of tests to help you better understand the requirements Those tests are by no means exhaustive 2.7 Utils The class Utils contains a number of methods to assist you to solve this assignment. Namely, you can use Utik.readCard) and Utils.readCards) to obtain one or several cards from the user, respectively. 24 Game (20 marks) The class Game implements the logic of the single player game of Rumany. . An object of the elass Game has two decks of cards, one is the main deck, whereas the second cne repeesents the player's The elass declares one coestructor. This comstructor has one parameser, which specifies the number of anks for this A Game object has only one publie instance method, which is called play. The method implements the logie od the hand. An object of the class Game also has a die (reference to an object of the class Die). game. When a Game object is created, it also creates the main deck and the die. ame Here is a description of the game: .Step O. The strange deck is created and shuffled. (In order to test your game more quickly you can reduce the number of Top of ranks to less than 13 and more than 3). In your implementation, the created deck is an object of the class Deck. the deck is considered the last card. . Step I. The player is dealt 7 cards from the top of the strange deck . Step 2 The following steps are repeated until the player runs out of the eards ie until the player's hand is empty: -The player rolls a die: . If the player pets a 1 The player can discard any one card she likes. Afier that, the current round is over and the game goes back to Step 2 If inslead the player gets 2, 3.4,5or6 The player is first delt, from the top of the deck, a namber of cards ooeresponding to the valoe of the die, or size of the deck of cards, whichever Es smaller The player then keeps on discarding melds from her hand until she has no more melds. You program has to check that the set of cards that the player chooses indeed foems a valid meld before discarding them from the player's hand Once she decides she is out of melds the round is over and the game goes back to Step 2 Finally,once the player is out of cards fie, once the player's hand is empty), the total number of rounds is reported and the game is over Noe that if the deck is empty and the player has no more melds, Bo melds can ever be created again. Thus the player has to wait for 1 on the die. In order to avoid that frustratiom, y am empty deck should rol i set num to 1, in each round that starts with As usal, whenever you ask the player for some input you should make sure they give you the required kind of input. You may assume that the player will folow instructions and give you a correct type of data. but not the correct values. For example. if you are asking tor an integer between 3 and 99, you may assume that the player will give you an integer, but not that she will give you an integer in the correct range. Thus you should keep on repeating the question until you pet a valid answer. Similary if you ask the player for a meld, you may assume that the player will give you a set of 3 cards, but you will need to test if these cards are indeed in the player's hand and that they form a meld. We provide you with several methods to help you with this part of the assignment. See 02/Utils java 2.5 Rurn We provide you with a class called Run. It contains the main method for this application. 2.6 Test We provide you with a class called Test. It contains a small number of tests to help you better understand the requirements Those tests are by no means exhaustive 2.7 Utils The class Utils contains a number of methods to assist you to solve this assignment. Namely, you can use Utik.readCard) and Utils.readCards) to obtain one or several cards from the user, respectively

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!