Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

This week you will finish your Five Crowns program by determining the points in

ID: 3837532 • Letter: T

Question

This week you will finish your Five Crowns program by determining the points in each hand.
Create a member function that evaluates the total point value of the hand:
A book (3 cards with the same face value) is zero points. An example is a 7 of stars, 7 of spades, and 7 of stars. If you have a fourth card of the same value (or a joker), you can include it in the book. So now four cards have a value of zero points (or 5 or 6 or so on).
Remaining cards are their values (12 for Queen, etc.)
Add the points in the hand.
Print the hands of the players and determine the winner (the lowest point value).
The game should prompt the player to determine if they wish to play again. If so, the cards in the hands should be returned to the deck and a new game dealt.
To evaluate the points is a more difficult task than might be assumed on first glance. A few suggestions:
If you have a joker, should it be considered a part of an existing book or used to help form another? I suggest using a plain deck of cards and trying the same basic idea with the deck of cards. Figure out how you would count the points if you were playing. What is it that you’re doing to figure out the points? Figure this out on paper, with several different hands.
Keep in mind that your goal is to find the lowest point value for the hand. The lowest of all is the winner. So, you will probably want to start with the highest point values to evaluate the points. In other words, you would prefer to match two queens with a joker than keep the two Queens unmatched, for 24 points, and match two threes with the joker instead.
Figure this out on paper! (Did I mention that already?) Try several different hands and make sure your algorithm works with all of them before you start coding.
Ninety percent of this challenge is this algorithm! Don’t start coding until you have it figured out.

Extra Credit: A run (3 cards with the same suit, with the face values in a row, such as 6-7-8 of diamonds) is zero points. If you have a fourth card, such as 9 of diamonds, you can include it in the run (or 5 or 6 or so on). If everything else is working, take a crack at determining how to incorporate runs into your game.

Explanation / Answer

PLAYERS: 1 to 7

OBJECT: To obtain the lowest number of points after playing all eleven hands of the game.

THE DECK: The game consists of two 58card decks. Each deck contains five suits: stars , hearts , clubs , spades

, and diamonds . Each suit has eleven cards: 3 through 10, a Jack, Queen and King. The game contains six Jokers.

CARD VALUES: Each number card is worth its face value, the Jacks are 11 points, Queens are 12, Kings are 13, Jokers

are 50, and the current wild card is 20 points. The wild card changes from hand to hand. For each hand, it is the card

which is equal to the number of cards dealt in the hand. Thus, when three cards are dealt, the 3s are wild, when four

cards are dealt, the 4s are wild, and so on until the last hand when the Kings are wild. Jokers are always wild.

RUNS: A run consists of a sequence of three or more cards of the same suit. i.e., 5, 6, 7, or 9, 10, J, Q.

Any card in a run can be replaced by any wild card or Joker. For example, when 7s are wild, a run could be made from

9, 7, J, or 6, 7, 7, 9. You can have as many wild cards or Jokersin a run as you wish (and they may be adjacent

to each other).

BOOKS: A book consists of three or more cards of the same value regardless of suit. i.e., 8, 8, 8, or K, K, K,

K. Any card in a book can be replaced by any wild card or Joker. For example, if 8s are wild, then a book could be 8,

Q, Q. You can have as many wild cards or Jokers in a book as you wish (and they may be adjacent to each other).

THE DEAL: Before each hand is dealt, all the cards (both decks) are shuffled together. In the first hand of the game,

three cards are dealt, one at a time in a clockwise direction starting with the person to the dealers left. In each

following hand, the amount of cards dealt increases by one; thus, the second hand has four cards, the third hand has

five cards, etc. In the last hand of the game each player has thirteen cards. After each deal, the remaining cards are

placed in the center as a draw pile, and the top card is turned over to start the discard pile.

THE PLAY: The player to the dealer’s left goes first, and play continues clockwise. Each turn starts with either drawing

a card from the deck or picking up the top card from the discard pile. The turn is completed by discarding one card. A

player can only lay down his/her books and/or runs when going out or, in turn, after another player has gone out. (See

GOING OUT.)

When a player is able to go out, the remaining players each have one last turn. Each remaining player, in turn, will

either draw from the deck or pick up the top discard. The player will then lay down all his/her books and/or runs,

discard one card, and count the cardsremaining in his/her hand as points against him/her. One cannot play on another

player’s books or runs. The value of the cards on the table does not matter, only cards remaining unused in the hand

are counted. The scorekeeper records the points and keeps a running tally.

The deal passes to the player on the dealer’s left, all cards are shuffled and the next hand is dealt. The number of cards

dealt increases by one card each deal, and the wild card changes as described above. Play continues until the eleventh

hand when the Kings are wild. Low score wins.

GOING OUT: After drawing from the deck or picking up the top card from the discard pile, if a player is able to arrange

all the cards in his/her hand into books and/or runs with one card remaining, he/she lays the cards down and discards

the one card to go out. The discard can be a card that could have been played on the cards laid down.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote