Find Jobs
Hire Freelancers

323079 Card game

N/A

In Progress
Posted almost 15 years ago

N/A

Paid on delivery
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 ([login to view URL]). 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 ([login to view URL]). 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.
Project ID: 2068886

About the project

Remote project
Active 12 yrs ago

Looking to make some money?

Benefits of bidding on Freelancer

Set your budget and timeframe
Get paid for your work
Outline your proposal
It's free to sign up and bid on jobs

About the client

Flag of
0.0
0
Member since May 24, 2009

Client Verification

Thanks! We’ve emailed you a link to claim your free credit.
Something went wrong while sending your email. Please try again.
Registered Users Total Jobs Posted
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
Loading preview
Permission granted for Geolocation.
Your login session has expired and you have been logged out. Please log in again.