### CPSC 120 Assignment #4 Five-card Draw Friday December 4, 2009 by 4 p.m.

In this assignment you will write a program that plays a variation of the poker game called five-card draw. The main idea of five-card draw is to get a hand of five cards with the highest rank. We will use the following ranks (from highest to lowest):

• Four of a Kind: four cards of the same rank
• Full House: five cards of two ranks
• Flush: five cards of the same suit
• Three of a Kind: three cards of the same rank
• Two Pairs: four cards of two ranks
• One Pair: two cards of the same rank
• Nothing: none of the above

The game proceeds as follows:

• Each player is dealt five cards from a deck.
• Each player is allowed to swap up to two cards for new cards from the deck.
• The player that has the highest rank wins.
• If multiple players have the same rank, then the player with the hand that contains the largest sum of card ranks wins.
• If multiple players have the same rank and sum, then it is a tie.

Your program will play the game between a human player and a dealer. It should ask for the name of the player, then have a loop that lets the player keep playing games against the dealer. It should clearly indicate what is happening as the game is played. The player should go first. When it is the dealer's turn if the dealer's rank is nothing, it should swap the two lowest valued cards.

Sample output:

```     Welcome to the Casino!
========================

Please enter the player's name: Bozo

Dealing Bozo's hand...
Bozo's cards are: 3♦ A♥ 8♣ 5♠ Q♥

Dealing Dealer's hand...

Bozo's turn...
Please enter the number of cards to exchange (0 - 2): 2
Please enter the index of a card to exchange (0 - 4): 0
Please enter the index of a card to exchange (0 - 4): 3

Bozo's cards are: 10♣ A♥ 8♣ A♠ Q♥

Dealer's turn...
Dealer's cards are: 2♥ 3♣ K♣ J♦ 8♠

Dealer exchanges 2 cards...
Dealer's cards are: 8♦ 9♥ K♣ J♦ 8♠

Bozo wins!

Please enter y or n to play again: n

```