Reference no: EM131315
Card Poker Game
Develop a simple poker game, complete with basic AI, using the object oriented programming principles discussed in class.
UML Class Diagram
Your assignment must contain and use the following classes:
Card and Deck Classes
The Card and Deck classes are direct carryovers from Lab #2. For more information about these classes, see the Lab #2 document on the course website.
Hand Class
You will need two instances of the Hand Class in your game: one for the player, and one for the computer. Each Hand will contain the respective player's current hand of cards. The hand class must have several helper methods that can be used to determine the strength of the hand. If you are unfamiliar with poker hands, Wikipedia has a related article that may be of interest.
PokerGame
Like the BlackJack class in Lab #2, the PokerGame class will be used to encapsulate all of the logic associated with playing the game of poker. The play method's operation will be discussed in the next section.
Flow of Play
Your poker game's play() method should operate as follows:
1. Deal the player five cards and display the results on the screen
2. Ask the player which cards he or she would like to exchange
3. Remove the desired cards from the player's hand
4. Deal the player N new cards (N = exchange amount)
5. Display the new hand on the screen
6. Deal the computer five cards and display the results on the screen
7. The computer determines how many cards to exchange based on the following logic:
a. zero cards if the computer has a four of a kind, full house, straight, or flush
b. one card if the computer has two pair
c. two cards if the computer has three of a kind
d. three cards if the computer has a pair
e. five cards if the computer has none of the above
8. Remove the appropriate number of cards in the computer's hand
9. Deal the computer the appropriate number of replacement cards
10. Display the new hand on the screen
11. Determine the winner of the game based on the following rankings:
a. Four of a kind
b. Full house
c. Flush
d. Straight
e. Three of a kind
f. Two Pair
g. Pair
h. High Card (ordered by Spade, Heart, Diamond, with Club being the lowest)
12. Indicate the winner on the screen