Answered step by step
Verified Expert Solution
Link Copied!

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 atzuct carda t char awst [7) char action [15) struct card-S ept: card You are allowed to add attributes to this definition, but not to remove any. You can represent colors hy 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 Figure 1: The deck of UNO cards. 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 loeses 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 btt/co.iedia.crg/w/Lndez.papeurd-2362748. Wild - This card represents all four colors, and can be placed on any card. The player has to state which color it will reprsent 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,ymust 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 ather player to show your hand to him/her. If guilty, yaa need to draw cards. If not, the challenger eeds to draw 6 cards instead 3. At the beginning, the user can choose to shuffle the deck or load a predefined sequence of cards fron a ile (or testing) 4. The deck is implemented by a dynamic list of cards. The cards drawnm from the deck are deeted froan the ist 5. Each players hand is implemented by a dynamic list ocards. The lEst i 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 shuied if the draw pale is exhausted and the game has not ended. Only the top ive cards of the discard pile are shown on scre 

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... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Business Communication Essentials a skill based approach

Authors: Courtland L. Bovee, John V. Thill

6th edition

978-0132971324

More Books

Students also viewed these Accounting questions

Question

List f our sourc es of c onflict. (p. 3 62)

Answered: 1 week ago

Question

What is one of the skills required for independent learning?Explain

Answered: 1 week ago

Question

Is the "hard sell" approach unethical? Why or why not?

Answered: 1 week ago