Answered step by step
Verified Expert Solution
Question
1 Approved Answer
C Programming - Game of UNO I need to code the card game UNO in C. I don't know how to set up the deck
C Programming - Game of UNO
I need to code the card game UNO in C. I don't know how to set up the deck for the game. I am told in my project rubric to have a "an UNO deck of cards being implemented as a linked list". Linked lists confuse me and I don't know what to do. If you could code a deck of UNO cards using a linked list, that would be awesome! You can see below what I am being asked of regarding on how to setup the deck.
2.1 Setup 1. UNO cards are represented as variables of the following type: typedef struct cards ( char suit [7); int value; char action [15]; struct card s pti > card; You are allowed to add attributes to this definition, but not to remove any. You can represent colors by using card suits Red: hearts; Yellow: diamonds Green: clubs; Blue: spades. The action field is used to denote the function of action cards. 2. The game is played using the following deck of cards. TETETETED SISISIGTIGTGTS 000000 662222 on an Lan Kanan La @10101010 101010101 010101010 8010101 6181818 Figure 1: The deck of UNO cards. 2 SLOTOTOTOTO The following action cards are included: Reverse - If going clockwise, switch to counterclockwise or vice versa. Skip - When a player places this card, the next player has to skip their turn. If turned up at the beginning, the first player loses his/her turn. Draw Two-When a person places this card, the next player will have to pick up two cards and forfeit his/her turn. by Dmitry Fomin https://commons.wikimedia.org/w/index.php?curid-29617438. Wild - This card represents all four colors, and can be placed on any card. The player has to state which color it will represent for the next player. It can be played regardless of whether another card is available. Wild Draw Four - This acts just like the wild card except that the next player also has to draw four cards as well as forfeit his/her turn. With this card, you must have no other alternative cards to play that matches the color of the card previously played. If you play this card illegally, you may be challenged by the other player to show your hand to him/her. If guilty, you need to draw 4 cards. If not, the challenger needs to draw 6 cards instead. 3. At the beginning, the user can choose to shuffle the deck or load a predefined sequence of cards from a file (for testing). 4. The deck is implemented by a dynamic list of cards. The cards drawn from the deck are deleted from the list. 5. Each player's hand is implemented by a dynamic list of cards. The list is initially populated with the cards dealt to each player. The card drawn (played) by each player is added to (deleted from) the respective list. 6. The discard pile is implemented by a dynamic list. The discard pile is shuffled if the draw pile is exhausted and the game has not ended. Only the top five cards of the discard pile are shown on screen.
Step by Step Solution
★★★★★
3.34 Rating (154 Votes )
There are 3 Steps involved in it
Step: 1
ANS ifndef Cardh define Cardh include include include include using namespace std class Card private string mvalue string mtype mscore score string Pl...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started