At the top of each file, put comments with your name, the date, course number, and assignment number. As always, write the program with a well organized structure, format it consistently, and document your program by naming functions and variables in a useful way, and by writing comments that would help someone understand how the code works so they could modify, enhance, or debug it. Functions should perform a specific and well-defined task that is described in comment lines above the function header. The logical flow of your program should be simple and easy to follow.
The program will "shuffle" a standard deck of 52 cards*, and will "deal" 5 cards to itself and 5 cards to you (these are called "hands"). It will display the 5 cards in your hand. It will ask you how many cards you want to discard (up to 3), and which ones they are (you can respond with 1, 2, 3, 4, 5 to identify which cards). Then it will replace these with 3 more from the deck (different from the ones already dealt, obviously). The program will then show you your new hand and classify it (for example, it will say "You have two pairs"). Then it will reveal its own hand and classify it, determine which one is better, and tell you who wins. It will then ask you if you want to play another hand, and continue playing hands with you until you say no. When you say no, it will tell you how many hands it won and how many you won, then exit.
The dealer (the computer) should get a chance to discard and draw just as you did. After giving you your new cards, make a call to a "stub" function (which, as always, has a name that accurately describes its function). You can leave the function empty (so the dealer always keeps its original hand), but this gives you a location to insert that code later. If you are interested, you can come up with an algorithm for deciding how many cards the dealer should discard, then insert it into this function, along with the code for replacing those cards. Filling in the code for this more challenging function is optional.
The next best hand is four-of-a-kind, which has four cards of the same rank such as 5-5-5-5-8. If both players have this hand, then the hand with the higher rank of the foursome wins.
Next is a full-house, which is three of a kind together with a pair, such as K-K-K-5-5. If the two players both have a full-house, the one with the higher rank of the triple wins.
After that is the flush, in which all five cards are of the same suit. If both players have flushes, follow the rule for high-card.
The next best hand after the flush is the straight, which is 5 cards in order, but not all in the same suit. As before, aces are high or low, but can't wrap around. Ties are broken by the high card rank in the straight, and if the high cards are of the same rank, then the one of higher suit wins.
After the straight comes three-of-a-kind; three cards are of the same rank, and the remaining two cards are not a pair. Ties are broken by the rank of the triple.
Next is two-pairs, which is two distinct pairs of cards, and a 5th card different from the rest. Ties are broken by the rank of the high pair.
Next we have one-pair - a matched pair and three other distinct cards. Ties are broken by the rank of the pair.
The worst hand is a hand which holds none of the above. Ties in this last case are broken by the high card. The card with higher rank wins, and if their ranks are the same, then the one with a higher suit wins.
_______________
* A standard deck of 52 cards has a 2, 3, 4, 5, 6, 7, 8, 9, 10, Jack (J),
Queen (Q), King (K) and Ace (A)
in each of 4 suits (Clubs, Diamonds, Hearts and Spades).
The cards are ordered - to tell if one card is higher than another, look at its rank
(they're listed above in increasing order). If the two cards have the same rank, then
look at the suit (they're listed above in increasing order)