Sign in to follow this  
vish40

i need help on my programming project guys!!!!

Recommended Posts

Alright this we have to create a memory game. It's a game where you have to pick two crads and if you pick the matching ones then they will be flipped and if you pick the wrong one the they will be flipped back down. This are the requirements. The program should first prompt the user to enter the dimensions of the board. The dimensions of the board may be any size, but you may assume a maximum size of 8x8. The game works with pairs of cards, so you must check that that total number of cards is even. If the user enters invalid input (i.e. negative dimensions or dimensions that produce an odd number of cards), it should re-prompt the user to enter new dimensions. Next, it should randomly place the pairs of cards on the board. Use characters to represent the cards. Place pairs of cards in the order a, b, c, …, z, A, B, C, … Z. In other words, you will place 2 a’s then two b’s and so forth until the board is filled up. For each card being placed, generate a random row and column coordinate until an empty spot on the board is found. Place the card in this spot making sure that the random coordinates you generate do not exceed the dimensions of the board. Before the game begins and after the cards have been placed on the board, create a cheat to make the game easier to win. To do this, print the contents of the board to a file named “cheat.txt”. By doing this the user of the program can open this file and see the position of each card. This will allow them to easily identify matching pairs. Once the board has been initialized, the game begins. The board should be printed in a grid and should not reveal each cards value. Use the setw function to print each spot on the board with a width of 3. Here is an example of how a 6x6 board should be printed and also the contents of a possible the cheat file for this board: The board printed to the screen: The cheat file: 1 2 3 4 5 6 1 © © © © © © 2 © © © © © © 3 © © © © © © 4 © © © © © © 5 © © © © © © 6 © © © © © © 1 2 3 4 5 6 1 e j g i c n 2 q o f p k o 3 b m c a r l 4 k p q m i r 5 d j b g d n 6 e l f h h a Notice that the coordinates of each card are printed above and to the left of the board. The coordinates of the board should be the values 1 to the size of the each dimension. This will allow the user to select a card by first entering a row and then a column number of a card. The program should prompt the user to enter the coordinates of one card, re-prompting if invalid coordinates are entered. Then it should print the board with this card flipped over. It will then prompt the user for the coordinates of another card, printing the board with both selected cards flipped over. If the cards do not match print the board again with neither card flipped over. If the cards match print a message telling the user that they found a match and print the board again with all found pairs printed as spaces. After finding a match your program should check if the game is over. If so, print a winning message and ask the user if they would like to play again. If they enter a ‘y’ or a ‘Y’, generate a new random board, write a new cheat file, and start the game again. If any at time while playing the game, the user enters a ‘?’ instead of the coordinates of a card, print a help message explaining how to play the game and then resume the game. You are required to create a Board class that stores the contents of the board. All variables must be declared private. Because the board may be of any size, the class must contain a 2-dimensional dynamic array. It should also contain a constructor with two integer parameters. This function should create the array to the proper size and initialize its contents. Your program must also have a destructor that deletes the dynamic array. I know a way to start this but i'm not sure about so please help me out if you can.

Share this post


Link to post
Share on other sites
Sorry, but you're not going to get any help for a homework project here. Please read the forum FAQs. If there's a specific thing you need help with such as generating random numbers, then go ahead and ask, but nobody is going to write the whole program for you. It's a very straight-forward assignment and they tell you specifically how to do every step, so it's just putting together everything you've learned so far in that class.

Share this post


Link to post
Share on other sites
Any help we give will only dig your hole further. Ask your teacher or TAs for help.

Also if you know of a way to start it why don't you just do it? No one said you had to get it right on the first, second, or third time, anyway. (I rewrote an OS scheduler 4 times until I got it right. It was very tight code by the end.)

Share this post


Link to post
Share on other sites
My favourite motivating quote:

"If a job's worth doing, it's worth doing badly" - G.K Chesterton

So, just get on with it. Once you've got something done you can start to make it better.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this