Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

[B] Let the user replace one of their cards in their hand, and auto-replace a low card in the computer's hand [C] Recognize if entire

[B] Let the user replace one of their cards in their hand, and auto-replace a low card in the computer's hand [C] Recognize if entire hand is all the same suit (a \"flush\"), and treat that as a winning hand In this assignment, we will be working on part B which lets user replace one of their cards in their hand, and auto-replace a low card in the computer's hand. Read the document carefully to make sure you have implemented everything required The Goal We want to allow the user and the computer to replace one card to improve their hand before deciding who won Implementation Steps: 1) First add a new method in Cardset class called GetOneCard that will be used by the user to replace one card public SuperCard GetOneCard) // gets one card from the deck of 52. Using very similar code to your GetCards method, add this new method. It must have similar logic to make sure the card it returns is not already in use, and it must set the property of the card it returns to be true. Note also that this method returns a single SuperCard, and not an array of cards as is done in GetCards method. In program.cs, implement a new method called PlayerDrawsOne that allows the user to replace one of the cards if the user wants to: public void PlayerDrawsOne (SuperCard[] hand, CardSet deck) Start by asking the user which card they want to replace, and allow them to type 1,2,3,4 or 5, etc, which is to indicate which card they want to replace, or they can enter a O if they don't want to change any card. If they do want to change a card, call your new GetOneCard method to get a new card, and replace that one card object in their hand array corresponding to the number they selected. Remember, arrays are \"by reference\" types, so when you pass in the array to the PlayerDrawsOne method, and the method modifies the hand array there, you don't have to return anything, as the original hand array is now modified too. Also note, if for example they say they want to replace their 3rd card, you should replace the card at index 2, since arrays are zero-index based In program.cs, in the main game loop, right after the cards for the player are displayed, call the new method PlayerDrawsOne passing the player's hand and myDeck field of type Cardset. 2) 3) Get this working before going forward. You should be able to play the game, and pick any of your cards to be replaced, or select a 0 and replace none. You will now have an advantage over the computer, as

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Finite Mathematics and Its Applications

Authors: Larry J. Goldstein, David I. Schneider, Martha J. Siegel, Steven Hair

12th edition

978-0134768588, 9780134437767, 134768582, 134437764, 978-0134768632

More Books

Students also viewed these Programming questions

Question

1. What are the three steps in the writing process?

Answered: 1 week ago

Question

7. What are the techniques for de-emphasizing bad news?

Answered: 1 week ago

Question

8. What are the ethical considerations for delivering bad news?

Answered: 1 week ago