views:

40

answers:

1

i have done only loops,if/else,arrays and functions. And im expected to finish this assignment by 5th October 2010. Would be really grateful if anyone could help me with this!!

Topic: Flip’em

Background: Flip’em is a fun matching game that helps you improve your memory. Your goal is to match each tile with its twin until all the characters behind the tiles are revealed.

Play the game: http://funschool.kaboose.com/fun-blaster/games/game_flipem.html

How to Play: 1. Click a tile. It will turn over to show you a character. There is another tile on the board that matches this one. You must try to find this tile. 2. Click another tile and see if it matches. 3. if it does, the two matching tiles will disappear 4. if it doesn’t, the two tiles will turn over again. Try to remember where you saw them 5. Repeat step 1 to step 4 until all tiles are revealed.

Your Assignment: • Develop a game with C that will automatically generate a set of board (2 dimension array) with pairs of characters randomly allocated each time the program is run. The user / player will be able to navigate through the board and flip the tile over to see the hidden character and try to find the match within the board.

Specification: • Each square contains the following suggested attributes : o a variable to store the character (by using ASCII code) o Indicator of whether the tile has been flipped over. o Indicator of what to display for the user / player to see. o Or any other attributes you think appropriate to your program Thus, square can be described as “struct” of array in the C programming language.

• The information of previous players is stored in a plain text data file. The information of all previous players should be displayed at the beginning of the game. User / player will also be prompted to key in their information to be stored in the text data.

• You are free to select the size of the array for your game. Minimum requirement of the board size will be 6 by 6.

• You are free to define the rules of the game, the criteria for winning the game, for the game to be over and evaluation of player performance. Please state the rules and instructions of your game clearly at the beginning of the program.

• Input to the system is through a DOS command window.

• Output should be printed in the DOS window as well as in a graphics window (optional) to show the latest layout of the board. For Dos Window, different characters can be used to represent the current position of player and any additional information.

• The assignment must be written in C using Quincy 2005. Build options must include strict ANSI/ISO compliance, C99 support.

Procedure Use an iterative process (spiral or prototype SDLC) to design and implement a solution to your program. That means 1. write a small program to do a little bit of the problem a. compile and run the small program 2. next, add a function or two a. compile and run the improved program 3. repeat step 2 until you are finished

Functionality This program must first prompt the user (in the command window) for the next action to be carried out. (Do provide appropriate menu of actions). After each action entered by the user, the latest layout of the board will be printed / display.

The user should be able to terminate the program at any time.

The program codes MUST be in functions. DO NOT write all the code in the “main()” function.

A: 

Assuming you mean 5th of November.

You should start by breaking the problem into pieces. Obviously you don't have the time or the skills to create the graphics window, so forget about that part. This is a pure console window game. So ask yourself the following questions:

  1. How will I display the board? How will users know what to enter to 'click' on a tile?
  2. How will I capture user input?
  3. How will I store the board state?
  4. How do I write/read from a file?

The hints you got are pretty specific, for example, you're told that you should use a struct to represent a tile. Therefore you could store an array of structs that represents the board, which should give you some idea how to store and display the board.

The skill you are learning here is how to translate requirements into specs.

Final advice: follow the process as explained by your instructor. This will assure that you get at least SOME credit on the assignment. Start by writing a program that, for example, prompts for your name, writes that to a file, then reads the file the next time you start the program and lists the names of all the people who have used the program. Or write a program that randomly generates a 6x6 matrix of 'tiles' and displays the matrix in it's 'flipped' and 'unflipped' state. In other words, figure out what problems you need to solve and solve them one at a time.

philosodad