For this portion of the assignment you are to write a Hearts 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.
Many trick-taking games are not directly related to Bridge or Whist. Perhaps the foremost one is Hearts, which is truly one of the greatest card games ever devised for four players, each playing individually. The game is fairly easy to play, yet there is plenty of scope for high strategy.
Number of Players. Three to seven people can play, but the game is absolutely
best for four, each playing for himself.
For this implementation, you are to construct a four player game, with
the user controlling one hand and the computer controlling the other three
The Deck. The standard 52-card deck is used.
Rank of Cards. A (high), K, Q, J, 10, 9, 8, 7, 6, 5, 4, 3, 2.
The Deal. The dealer completes
the cut and distributes the cards one at a time, face down, clockwise. In a
four-player game, each is dealt 13 cards.
The Pass. After looking at his hand, a player selects any three cards and passes them face down to the player on the left. The player must pass the three cards before looking at the cards received from the right. There is a passing rotation of left, right and across. A recent popular passing variation is to designate the fourth hand of every deal as a keep or hold hand where no cards are passed.
Object of the Game. The goal is to avoid winning in tricks any heart or the Q (called Black Lady or Black Maria). Or, to win all 13 hearts and the Q (referred to as "Shooting the Moon"). Ultimately, the object of the game is to have the lowest score when the game ends.
The Play. The player holding the 2 after the pass makes the opening lead. Each player must follow suit if possible. If a player is void of the suit led, a card of any other suit may be discarded. However, if a player has no clubs when the first trick is led, a heart or the queen of spades cannot be discarded. The highest card of the suit led wins a trick and the winner of that trick leads next. There is no trump suit. The winner of the trick collects it and places it face down to form a neat "book" or stack of cards. Hearts may not be led until a heart or the queen of spades has been discarded. The queen does not have to be discarded at the first opportunity. The queen can be led at any time.
Scoring. A separate column on a score sheet is kept for each player. At the end of each hand, players count the number of hearts they have taken as well as the queen of spades, if applicable. Hearts count as one point each and the queen counts 13 points.
Each heart: 1 point
The Q: 13 points
The point totals are then entered in each player's column. The aggregate total of all scores for each hand must be a multiple of 26. Note: The number of tricks a player wins does not count per se; the scoring is based solely on who wins tricks containing hearts and/or the queen of spades.
The game is usually played to 100 points (some play to 50). When one player hits the agreed upon score or higher, the game ends; and the player with the lowest score wins.
"Shooting the Moon." One of the great thrills of the game, shooting the moon or making a "slam", is when a player takes all 13 hearts and the queen of spades in one hand. Scores will differ dramatically. Instead of losing 26 points, that player scores zero and each of his opponents score an additional 26 points.
1) Instead of a score sheet, chips are used. Each player pays one chip for each heart, thirteen chips for the Q, and the lowest score for the deal takes all. Players who tie split the pot, leaving any odd chips for the next deal.
In this version called Sweepstakes, each player pays one chip for each heart
and 13 chips for the Q.
If one player alone scores zero, he takes the pot; if two or more players make
zero, they split the pot. If every player earns 1 point or more, the pot
remains for the next deal,
or until it is eventually won.