Find Jobs
Hire Freelancers

319534 Programming Project 491815

N/A

Finalizat
Data postării: circa 15 ani în urmă

N/A

Plata la predare
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. 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. 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]). 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. You can also introduce more rules and design your own rules for this extension. There is no standard answer for this level of programs. Any good ideas and innovations are welcome and will be highly rewarded ( For instance, you can implement a SmarterPlayer with learning ability to learn from Human Player).
ID-ul proiectului: 2065338

Despre proiect

O propunere
Proiect la distanță
Activ: 12 ani în urmă

Vrei să câștigi bani?

Avantajele de a licita pe platforma Freelancer

Stabilește bugetul și intervalul temporal
Îți primești plata pentru serviciile prestate
Evidențiază-ți propunerea
Te înregistrezi și licitezi gratuit pentru proiecte
Acordat utilizatorului:
Avatarul utilizatorului
Greetings, Please see my detailed post on the PMB.
$100 USD în 3 zile
0,0 (0 recenzii)
0,0
0,0

Despre client

Steagul
Sydney,
5,0
2
Membru din mai 14, 2009

Verificarea clientului

Alte proiecte ale acestui client

321217 Programming Project 1242824458
N/A
Mulțumim! Ți-am trimis prin e-mail linkul pe care trebuie să-l accesezi pentru a revendica creditul gratuit.
A apărut o eroare la trimiterea e-mailului. Încearcă din nou.
Utilizatori înregistrați Totalul proiectelor postate
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
Se încarcă previzualizarea
S-a oferit permisiunea de depistare a locației.
Ți-a expirat sesiunea pentru conectare sau te-ai deconectat. Conectează-te din nou.