Anyone can help me to finish this c++ question? Please contact me by email.

UNO
UNO is one of the world's most popular family card games, with rules easy enough for kids, but challenges and excitement enough for all ages.

In this assignment, we will program a simplified version of UNO. Most of the cards are of four different colors: red, green, blue and yellow. For each color, there are one zero, and two for each value from 1 to 9, i.e. altogether 19 cards for one color. In addition, there are some function cards, but we used only one special card “Draw 4” in this assignment and we have four “Draw 4” cards in total. Thus the total number of cards in a deck is thus 80.

The whole deck of cards is first shuffled and piled together. Each player is dealt 7 cards with the remaining ones placed face down to form a "draw" pile. The top card of the draw pile is turned over to begin a "dis-card" pile. The first player has to match the card in the discard pile either by number or color. For example, if the card is a red 7, player must throw down a red card or any color 7. Or the player can throw down a special Card. If the “Draw 4” card is used, the player following the issuer have to draw 4 cards from the deck. If it happens that the next player also used the “draw 4”, then the cards to be drawn by the player following the next player will accumulate. If the player doesn't have anything to match, he or she or it must pick a card from the draw pile. After that, play moves to the next person.

If a player fails to match the number card in the discard pile, the player has to draw one card from the "draw" pile.

Once a player has no card left, the game is over and he or she or it will be the winner. There may also exist a situation that all the cards from the draw pile are exhausted. In this case, the player with the least number of cards will be the winner.

Please note that there is no "cut" action in order to simplify your task. In addition, the first card in the "dis-card" pile could be a "Draw 4" card too. In such case, the first player has to act as if the predecessor issued a "Draw 4". There are altogether 4 players: the first three being the computer while the last one being the hu-man player. Computer player should play first. They are not expected to show any intelligence but they must follow the rule of the game.

Requirement

Write a C program to simulate the above game on the computer. The simulated game will have 4 play-ers—one of the players is the program user and the remaining players will be the computer itself i.e. you should write the code for all the computer players in throwing or drawing cards.

To increase the viewing fun of the process, use the full-screen control functions that are provided with the assignment. The screen control functions are only a few:

  1. clear screen function,
  2. move cursor function.
  3. set_text_color function

Your program should read a parameter to control the pace of execution. The delay can be inserted by calling Sleep() function. The information of Sleep is as below.

void Sleep(int);
/************************************************************
* Sleep(time)
*
* - Delay the program for time millisecond
*
* - input: (time) delay time in milliseconds
************************************************************/

Finally your program should have the following features:

  1. You must use structure of C to perform the card processing.
  2. Your program should at least consist of 2 functions reasonably.

Recommended Answers

All 8 Replies

What have you done so far?

Actually, the problem statement very clearly says to use C and assembly, not C++. I think you are confused about what language you are supposed to be using.

C is different from C++?
sorry, i only start learning C two months ago><
I haven't start to work, but I want to know how to start and how the Sleep function work.
Thanks

Yes. C++ is partly based on C, but it is a completely different language.

As for the Sleep() function, I am asuming that th text is referring to the Windows API function of that name. While the details of how it works are proprietary to Microsoft, the way you use it is simple: you call it with an int argument indicate the minimum number of milliseconds the program should pause. For example,

Sleep(33);

will cause the program to stop running for at least 33 milliseconds (I say 'at least' because the Windows scheduler may not pass control to the program immediately, so the delay may be longer depending on how heavily loaded the system is). That happens to be 1/30th of a second, which is about how fast you would want a video game's frame rate to be to ensure smooth animation. With a game like the one you are describing, you would probably wait something more like 250 milliseconds (1/4 of a second).

Can you give me your email? so that i can ask you some questions more easily=]

We generally prefer to conduct our answers in public, and in any case, no one here is likely to publish their e-mail address on a public forum. Thank you, but I get enough spam as it is, and while I know you wish only to make things easier, there are plenty of vultures around the net who will grab any e-mail address they stumble upon. Perhaps I would send it to you by PM, not on the site itself, certainly.

sorry,can you send your email to me by PM?because i cannot find the PM button><

Please read the forum rules:

Do not ask anyone (member or moderator) for help by email or private message

Keep it on the forums and show that you have made some effort if you are seeking homework help.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.