For this portion of the assignment you are to write a Poker card game in Java utilizing a graphical user interface.  It is assumed that you have successfully implemented the Card, Deck, Hand, Rank, and Suit classes that are to be used with this program.


The Deck. The standard 52-card deck is used.

Object of the Game. The goal of each player is to win the pot which contains all the bets that the players have made in any one deal. A player makes a bet in hopes that he has the best hand, or to give the impression that he does. In most Poker versions, the top combination of five cards is the best hand.

Poker Hands. While Poker is played in innumerable forms, a player who understands the values of the Poker hands and the principles of betting can play without difficulty in any type of Poker game. Except in a few versions of the game, a Poker hand consists of five cards. The various combinations of Poker hands rank from straight flush (the highest) to no pair or nothing (the lowest):

Straight Flush. A straight flush consists of five cards of the same suit in sequence, such as 10, 9, 8, 7, 6 of hearts. The highest-ranking straight flush is the A, K, Q, J, and 10 of one suit, and this combination has a special name: a royal flush or a royal straight flush. The odds on being dealt this hand are 1 in almost 650,000.

Four of a Kind. This is the next highest hand, and it ranks just below a straight flush. An example is four aces or four 3s. It does not matter what the fifth, unmatched card is.

Full House. This colorful hand is made up of three cards of one rank and two cards of another rank, such as three 8s and two 4s, or three aces and two 6s.

Flush. Five cards all of the same suit, but not all in sequence, is a flush. An example is Q, 10, 7, 6, and 2 of clubs.

Straight. Five cards in sequence, but not all of the same suit, is a straight. An example is [Spade Symbol]9, [Diamond Symbol]8, [Diamond Symbol]7, [Heart Symbol]6, [Spade Symbol]5.

Three of a Kind. This combination contains three cards of the same rank, and the other two cards each of a different rank, such as three jacks, a seven, and a four.

Two Pairs. This hand contains a pair of one rank and another pair of a different rank, plus any fifth card of a different rank, such as Q, Q, 7, 7, 4.

One Pair. This frequent combination contains just one pair with the other three cards being of different rank. An example is 10, 10, K, 4, 3.

No Pair. This very common hand contains "nothing." None of the five cards pair up, nor are all five cards of the same suit or consecutive in rank. When more than one player has no pair, the hands are rated by the highest card each hand contains, so that an ace-high hand beats a king-high hand, and so on.


Two hands that are identical, card for card, are tied since the suits have no relative rank in Poker. In such a case, the tied players split the pot. Note that if two hands contain the same high pair, then the ranking of the next card in the hands determines which one wins. For example: 9, 9, 7, 4, 2 beats 9, 9, 5, 3, 2. Likewise, two hands that have identical pairs would be decided by the fifth card. For example: Q, Q, 6, 6, J beats Q, Q, 6, 6, 10.


Implementation Variations

1. Video Poker

Video Poker is the simplest implementation, as only one player is involved.  Only the ranking of the hands is the same as in table poker. Since the game is played on a machine, your only objective is to get the best-paying hand. Video Poker is usually implemented as a "Jacks or Better" game, where a pair of Jacks or better is required for a payout.  The player bets one to five coins prior to the deal. The computerized machine deals a five card hand. You may keep or throw away as many cards as you like by activating the appropriate button underneath each card. After selecting the card(s) you want to hold or discard, press or click on "deal/draw." The cards you didn’t want to keep are replaced with new cards. If the new hand consists of a winning combination, you get paid according to the following, ranked from high to low.

Royal Flush - A, K, Q, J, and 10 of the same suit. It’s the highest-paying hand in poker and occurs, on average, once every 40,000 hands. Pays 4,000 or more coins when five coins are bet; otherwise, pays only 250 coins for each of 1 to 4 coins bet.

Straight Flush – Five consecutive cards in the same suit, for instance 8, 9, 10, J and Q. Pays 250 per coin bet.

Four of a Kind – A hand with four cards of the same value, such as four Nines. Pays 125 per coin bet.

Full House - Three cards of one value, and two cards of another value, like three Fives and two Kings. Pays 45 per coin bet.

Flush – Any five cards of the same suit, in no particular order. Pays 30 per coin bet.

Straight – Any five consecutive cards, such as J, 10, 9, 8 and 7, but not in the same suit. Pays 20 per coin bet.

Three of a Kind - Three cards of the same value, three Sevens for instance. Pays 15 per coin bet.

Two Pair – A hand containing two pairs, such as two Tens and two Aces. Pays 10 per coin bet.

Pair of Jacks or Better – A pair of Jacks, Queens, Kings or Aces makes up the lowest paying hand, hence the name of this variant of the game.  Pays 5 per coin bet.


2. Draw Poker

There are several methods of playing Draw Poker, and they differ mostly in the rules governing betting. The essential features of the game, common to all varieties, are as follows:

Each player is dealt five cards face down, one at a time in rotation, beginning on the dealer's left. After the deal, there is a betting interval. The player on the dealer's left has the first right or obligation to bet.

When the first betting interval has ended, each active player in turn, beginning with the player on the dealer's left, may discard one or more cards, and the dealer then gives him, from the top of the undealt portion of the pack, face down, as many cards as he discarded. This is the draw. A player may, if desired, "stand pat" (draw no cards). Unless otherwise stated, the maximum number of cards a player may draw is three or, if the player shows an ace to all the other players, he may draw four. (In some games, especially in casinos, a player may draw four cards without exposing an ace, or may draw five cards - a fresh hand.) Note that, unlike some other card games, the player must always discard before taking any new cards for his draw.

After the draw, there is another betting interval, followed by a showdown where all remaining players show their hand and a winner is declared.