Final - Memory Game

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 17

Memory Game

Understand the Application


This GUI application is a classic memory game that displays a board filled with cards flipped
upside down. The player is allowed to flip two cards at a time and if the cards match, then they
are removed from the board and the player is awarded a point. The game ends when all of the
cards are removed from the board.

The player will be given a few options to play the game, which includes playing single player,
player vs computer, or player vs player, as well as difficulty levels that change the number of
cards used on the board.

Board Size (number of cards on the board):


Small – 4 X 4 (8 pairs, 16 cards total)
Large – 6 x 6 (18 pairs, 36 cards total)

Player Modes:

Single Player Mode Single player mode is a relaxed mode of the game. There is a
timer that counts up and allows you to pause the game as
needed and resumes when the player clicks “Continue” button
or starts clicking on the cards.

At the end of the game the time it took for the player to find
all of the pairs is displayed, and asks if the player wants to start
again.
Timed Single Player Mode In the timed single player mode, the user must get as many
pairs as they can during the allotted time.

The timer is given a suggested time, depending on the


Difficulty level. However, the timer is allowed to be adjusted in
the beginning of the game, but once the game starts, it cannot
be adjusted anymore.
Player vs Computer In player vs computer mode, the user plays against a
computer, and takes turn flipping cards. If the computer or
user gets a pair, they are allowed to flip again until they no
longer make a pair.

The computer will have 4 different levels of difficulty.

Easy – The computer will remember 1/5 times a card and its
position. It will do this for every card.
Medium – The computer will remember 1/3 times a card and
its position on the board.

Hard – The computer will remember ½ times a card is played


and its position on the board.

Impossible – The computer will always remember the card and


its position as they are being flipped.

The computer will randomly select a card on the board, and


then check if it has seen its pair before. If it has it will flip the
other card and get the pair. If it hasn’t, it will randomly add the
card to its “memory” (array) based on the ratios mentioned
above. Impossible will always remember.

Whoever has the most pairs after the cards have cleared the
board wins.

There is no time limit.


Player vs Player In player vs player, player 1 will play against player two.

There is no time limit.

The player with the most pairs wins.


The Program Spec
This application will be using a Model – View – Controller (MVC) Pattern, as well as
Multithreading for time keeping throughout the application. You can edit the images in the
image folder to make your own Memory game.

Class MemoryModel
The first step we will do is start the game model. This will work with the
MemoryGameTimedFramework

Class Card
Display the cards 1-18 (since they are pair, we will add two cards of the same value on to the
screen).

Class MemoryGameTimedFramework
Creates a timed game framework for single player.

Class MemoryGameCompeteFramework
This framework has you compete with the computer, and you will set the difficulty of the
computer through here via the MemoryModel class.

Class GUIMemoryCards
Uses the Icon class to create the images from the image folder

Class Timer
We will use Timer and an action lister to update the timer.

Class MemoryView extend JFrame


This creates the framework for the game. It will extend JFrame and create the layout.
Memory Game title on the top, Timer towards the right, and the Game Information towards the
bottom of the screen. With the Game Layout towards the center of the screen.

Class MemoryController
This will communicate between the MemoryView and MemoryModel class
Main Class
This class will call on MemoryView, MemoryModel, MemoryController, and AddTimer, and set
the MemoryView visible.
What to expect
Vs Computer

You might also like