0% found this document useful (0 votes)
31 views1 page

X 9950 Prog 1

The program simulates a 4 player card game with a standard 52 card deck. Each player is dealt 13 random cards. The human player sees their hand and bids how many tricks they will win. The computer randomly plays cards and scores points for tricks won/lost based on the bid. The game ends when a player reaches 150 points.

Uploaded by

Ishaq Khan IK
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
31 views1 page

X 9950 Prog 1

The program simulates a 4 player card game with a standard 52 card deck. Each player is dealt 13 random cards. The human player sees their hand and bids how many tricks they will win. The computer randomly plays cards and scores points for tricks won/lost based on the bid. The game ends when a player reaches 150 points.

Uploaded by

Ishaq Khan IK
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 1

Create a program to simulate a card game as described below.

Use a standard deck of 52 cards, which contains 13 different values (numbered 1 through 13) and 4 different suits. The suits may be any theme you like (does not have to be hearts, spades, etc.). Make this a four player game, where three of the players are controlled by the computer, and one player is controlled by the user. After shuffling, deal all of the cards to the four players. Each player will get 13 cards. Notes: 1. Make a class named Card, as well as a class named Deck 2. Shuffle the cards by randomly swapping 5000 pairs of Cards 3. Store the players hands in arrays of type Card The Game: 1. Display the player's 13 cards, but do not show the 3 other hands 2. Have the player 'bid' how many tricks they think they will win 3. If bid is made, the player scores 10 points for each trick bid 4. The computer scores 10 points for each trick made 5. The player loses 10 points for each trick bid if the bid is not made 6. Each time a computer controlled player leads a card, randomly choose a suit and lead the highest card of that suit 7. Each time a computer controlled player has to follow suit, play the highest card if the computer could win the trick, lowest otherwise 8. If a computer controlled player has to 'throw off' due to not having the suit lead, throw the lowest card from the suit it has the most of 9. When any player reaches 150 points, the game ends Keep in mind the following:

Name your source files cards.h, cards.cpp, and main.cpp. With invalid data, your program should respond appropriately. Each function prototype should have a description, preconditions, and postconditions. Test your code when you think you are finished. Try to break it. After you are done trying to break it, I will then try.

You might also like