Hi
My requirement doc (trying to do hoping it would be fun)
1.) Create a C program that plays "Go Fish" for a 2 person game (The user and computer).
2.) When the game starts have the computer create a deck of cards and deal 10 cards to the user and to the computer.
3.) Display the dealt hand(s): The remaining cards are put into a Draw Pile. Create a statement at the top your program that looks like this: #define DISPLAY 1
a. if DISPLAY is set to 1 then display all user's and computer's cards.
b. If DISPLAY is set to 0 then display only the user's cards.
4.) Each player counts the number of pairs he/she has and removes those cards from their hand into a User Pair Pile and a Computer Pair Pile (display the User's pile and Computer's pileon the screen!). The players get a point for each pair, display these points on the screen.
5.) The user starts first and requests a card from the computer. Incorporate a check to ensure that the user does have a card with the same face value.
6.) If the computer has a matching card, it must be handed over to the user, if not the user must draw the first card from the draw pile.
7.) If the user can make a match, he/she does puts the matched pair into the User Pair Pile. Each match gets a point.
8.) Play now passes to the computer and the computer requests a card from the user.
9.) Track and display the number of points for the user and computer.
10.) Once all the pairs are made, the game is over and the winner is declared based on the number of matches made.
11.) Track and display the number of times the computer and user has won. You may
start at zero at the start of the game.
12.) After a game is over, you should query the user to continue playing or exit the program.
14.) Allow the user to exit the game and restart in the same place anytime they want (not just at the end of a game, but in the middle of the game). In other words, during a game the user can exit the program, then restart the program at the very place where they left. You must keep track of the user hand, computer hand, draw pile, and both pair piles along with all the game statistics. Be sure to display these statistics.
MY EFFORT : i tried to write in some way i went no where ,, finally my code is useless as said by instructor :( so help required :) anyone show some light ,,
Cheers
Thank you
Loading

VulpesPosted Oct 29, 2013, 8:56 PM
I didn't have time to deal with point 14 where I imagine you're supposed to save the state of the game to a file and then load the file when the program is next run.
There are some aspects of the game which aren't clear. For example, it says in point 10 that the game is over once all the pairs are made but there are only 26 pairs in the deck and there's no point in continuing once some-one gets 14. It's also possible to have a drawn game with 13 pairs each.
It's also not clear what happens if a player has no cards left but the game isn't yet over. I've assumed that the player just draws cards from the deck.
Although the computer is one of the players, I assume in practice its decisions will be made by a human player. I've also designed the code to work on a standard 80 x 25 console - the output will look a mess otherwise: