322198 Programming Project 1243169115
N/A
Pagado a la entrega
1. Problem: Playing Cards
1.1 General description
You are required to write a C++ program to simulate a simple card game. The rules of the
game are the following:
• A standard deck of 52 playing cards are dealt randomly to four players, each receives
13 cards. Cards rank from 2 (lowest) to A (highest).
• Initially, one player is randomly chosen as the banker. A game runs in several rounds.
• At each round, the banker plays a single card from his hand. The next player
(clockwise) can choose either to “suppress” the card by playing a card with higher
rank (disregarding suits) or to “pass” his turn to the next player. All players take turns
until no player wants to suppress the current card (the desk card). The owner of the
desk card becomes the banker of the next round.
• A player wins if he finishes all his cards before any others.
1.2 Tasks and marking criteria
Students who are seeking for pass grade should accomplish the following tasks:
Task 1: Create a class called Card that represents a playing card. The class should
include two private data items: value and suit. The member functions of the
class should include, but not limited to, getValue(), setValue(int), getSuit(),
setSuit(int) and displayCard() for accessing data members and display cards.
Task 2: Create a class called Player to simulate a dummy player. The class should
include at least two data items: playerName (string or char*) and CardsInHand
(array or vector of Card objects). The class should implement at least the
following member functions: setPlayerName (string or char*),
getPlayerName(), addCard(Card), play(Card&). The strategy of playing a card
can be as simple as giving the first available card in hand that can suppress the
desk card.
Task 3: Create a class called Game to simulate single game playing. The class should
be able to:
• Generate a deck of cards
• Shuffle the deck
• Deal the deck to each player
• Randomly pickup one player as the banker before a game starts
• Proceed with each round: collecting players' cards, updating information on
the current banker and desk cards, taking turns and determining the winner
and the banker.
Task 4: Write an application (.cpp) to simulate game playing
Note: An example program (executable file) in this level is downloadable
([url removed, login to view]). You do not have to follow exactly the way I did.
Students who are seeking for credit grade should accomplish all the above tasks as
well as the following extra tasks:
Task 5: Create a class called SmartPlayer, which is a derived class of Player
(inheritance). The class implements smarter playing strategies in order to win
the players.
Task 6: Change the application program in Task 4 to simulate multiple game playing.
Set one of the players to be the SmartPlayer and play against dummy players.
Your SmartPlayer should be able to win more than half of total games.
Note: An example program (executable file) in this level is also downloadable
([url removed, login to view]).
Students who are seeking for distinction grade or higher should accomplish all the
above tasks 1-6 as well as the following extra tasks:
Task 7: Create a class called HumanPlayer, which is also a derived class of Player.
HumanPlayer allows a human user to play against computer players (simply
providing an interface for the user to input the card or cards to play).
Task 8: Extend your program to allow a player to play multiple cards:
• Twin: two cards in same rank
• Triplets: three cards in same rank
• Bomb: four cards in same rank
A bomb can suppress any single, twin, triplets or a bomb in lower rank. A twin can
only be suppressed by another twin in higher rank. Similar rules apply to triplets.
To be ready in half an hour
Nº del proyecto: #2068004