Welcome to Dream.In.Code
Become a Java Expert!

Join 149,478 Java Programmers for FREE! Get instant access to thousands of Java experts, tutorials, code snippets, and more! There are 1,490 people online right now. Registration is fast and FREE... Join Now!




memory game code

 
Reply to this topicStart new topic

memory game code, java memory game

Rating  5
needjavahelp
24 Apr, 2007 - 07:18 PM
Post #1

New D.I.C Head
*

Joined: 24 Apr, 2007
Posts: 2


My Contributions
I need to create a simple game and is anyone paitient enough or kind enough to help us out?

It is a memory game.
The player clicks on a card and another cards and if it matches, the cards disappears.

This is urgent help and it's stressing me out so much I think I'll commit suicide...


this is what the classes i have and their responsibilities
i want teh working code/.//

Card class
- Stores the cards value/id
- Flips the card
- Stores the state of the card (face-up, face-down, hidden)
- Checks if the card is equal to another card
- Hides the card

Grid class
- Creates the cards
- Shuffles the cards

Game class
- Creates a grid
- Starts Game
- Ends Game
- Keeps Score
- Responds to card selection

HighScores class
- Stores the top 5 Scores
- Updates the top 5 Scores
- Checks if a score is in the top 5
- Sorts the top 5 scores

Score class
- Stores the players name
- Stores the score
User is offlineProfile CardPM
+Quote Post

William_Wilson
RE: Memory Game Code
24 Apr, 2007 - 07:44 PM
Post #2

lost in compilation
Group Icon

Joined: 23 Dec, 2005
Posts: 4,101



Thanked: 25 times
Dream Kudos: 3275
Expert In: Java, C, Javascript

My Contributions
Please show us what you have done so far, no matter how little, you must show an attempt. Remember when you post your code to use the [code ][ /code] tags around it (without the spaces).
Please read the rules (links available in my signature) for further guidlines on getting better/proper help.
User is offlineProfile CardPM
+Quote Post

needjavahelp
RE: Memory Game Code
25 Apr, 2007 - 11:41 AM
Post #3

New D.I.C Head
*

Joined: 24 Apr, 2007
Posts: 2


My Contributions
this code is for the game class...

can u pls check against the responsibilities of game as mentioned earlier...



all other codes are attached
CODE



/**
* Write a description of class Game here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class Game
{
    // instance variables - replace the example below with your own
    private Grid grid;
    private HighScores highScores;
    private int score;

    /**
     * Constructor for objects of class Game
     */
    public Game()
    {
        // initialise instance variables
        highScores = new HighScores();
    }
    
    /**
     *
     */
    public void start()
    {
        grid = new Grid(25);
        grid.shuffle();
        score = 0;
    }
    
    /**
     *
     */
    public void end()
    {
        highScores.update(score);
    }
    
    /**
     *
     */
    public void cardSelected(int cardNumber)
    {
        grid.getCard(cardNumber).flip();
        //If 2 cards selected then check equals and incr score
    }
}



Attached File(s)
Attached File  stg_2.zip ( 8.04k ) Number of downloads: 82
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 1/7/09 04:01PM

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter

Live Java Help!

Java Tutorials

Reference Sheets

Java Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month