C++代写:CS1037 Simulation of An Uno Game

代写一款类似抽乌龟的纸牌游戏,练习Stack和Queue以及OrderedList的使用方法。

Your task

In this assignment you will create a simulation of an uno game between multiple players. These players however are not very smart (or at least don’t have to be).

The game:

  • Cards consist of 1 colour and 1 number each.
  • For our game there will be 4 colours red, yellow, blue and green
  • For our game there will be 5 ranks 1,2,3,4, and 5

Game Simulation:

  • There will be 3 players for our game (you may name them if you’d like)
  • The deck will consist of 2 copies of each of the ranks for each of the colours ie: there are 2 Red-2 cards, 2 Blue-5 cards, 2 Yellow-3 cards, etc etc
  • At the start of the game 3 player objects will be created
  • A bag of cards will be created consisting of ALL the cards of the deck.
  • Cards will be taken randomly from the bag(until empty) and placed into a Queue that represents the deck pile
  • 7 cards for each player will then be taken from the deck pile and placed into the hand of each of the 3 players the hands of the players must be an OrderedList
  • 1 card will be taken from the deck pile and placed into the faceup pile. The faceup pile must be a

Stack

You will then loop UNTIL the game is finished (the game is finished when a player has no cards left in their hand) each player will have a turn. A turn consists of the following

  • a) Check to see if they have a card in their hand with the same number as the card on the top of the face up pil. if true take that card out of their hand and place it on the face up pile.
  • b) If the above fails check to see if they have a card in their hand the same colour as the card on top of the face up pile. If true take that card out of their hand and place it on the face up pile.
  • c) If both of the above fail draw a card from the deck pile (the hand will grow by one the deck will shrink by 1 after this action.
  • d) If the deck pile runs out of cards take and save the top of the faceup pile. Then place all cards in the facedown pile into the deck pile. Finally place the card you saved back on top of the faceup pile. After this is complete the faceup pile will contain just a singular card.
  • e) Check to see if a player has UNO that is 1 card left f)
  • Finally check to see the player has 0 cards left and is the winner of the game.

After a players turn is finished you must transfer control to the next player and repeat the steps above.

What to show

  • At the start of the game you should have a welcome message such as “Welcome to Uno”.
  • When the game is beginning it should say “start” and then show the card that is the start of the face up pile
  • Each time it is someones turn you will print an identifier for them such as “It is Player 1’s turn” followed by what happens during their turn that is to say you will write a message similar to one(or more in the case of deck being repopulated, UNO, or winner) of the following.
    • a) “Player 1 found a match! They played Red-5.
    • b) “Player 1 did not find a match. They drew a card”.
    • c) “The deck has been repopulated”
    • d) “Player 1 yells UNO!”
    • e) “Player 1 has crushed their enemies in UNO (not even close)

Must have classes

UnoCard

  • This class represents a card in the game.
  • it can have one of 4 colours red, blue, green, yellow ( I suggest using an enum).
  • it can have one of n numbers eg 1,2,3,4,and 5.( for our default game n will be 5)
  • it needs to have someway of being printed ( I HIGHLY SUGGEST the operator[[ )

UnoPlayer

  • This class represents a player in the game.
  • They have names ( can be something simple like Player 1 but can be whatever you’d like).
  • They have a hand that contains cards and is an OrderedList.
  • They contain the function to look for a card match.
  • They need to be able to be printed as well ( AGAIN I suggest the operator [[).

UnoGame

  • This class represents a game of uno.
  • It has defines for represent number of players, number of cards players start with, and number of numbers cards can have (ie #define NUM_OF_PLAYERS 3).
  • It has a Stack representing the face up cards.
  • It has a Queue representing the face down cards or deck.
  • Its Constructor will initialize the game:
    • a) Create all the cards place them in a bag.
    • b) Randomly pull cards from the bag and place them into the deck.
    • c) Create players.(NOTE THESE SHOULD BE STORED IN A CONTAINER SO SOMEONE COULD MAKE THE GAME HAVE MORE PLAYERS IF THEY WANTED)
    • d) Draw cards for each player and place them into their hands.
    • e) Draw a starting card for the face up pile.
  • It will have a play() method that will play the game (see game simulation above)

Extra notes

ALL code shown in labs is fair to use. ALL code shown in lectures is fair to use. You may discuss with each other the assignment HOWEVER the assignment itself MUST be coded individually copying is not allowed.
To receive 100% your code must be clean, and extensible.