MemoryMatching Class Reference
[Memory matching minigame]

#include <MemoryMatching.h>

Inherits GameController, and MouseListener.

Collaboration diagram for MemoryMatching:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 MemoryMatching (int diffLevel)
virtual ~MemoryMatching ()
void draw (BITMAP *canvas)
 This function will also be called each screen refresh to draw to the buffer.
void step ()
 This function will be called each time unit of the game.
bool isComplete ()
 This function can be called to check if the GameController is done.
bool containsPoint (Point point)
void mouseClick (MouseEvent *e)
 Called when the mouse clicks on a MouseListener.
GraphicgetDirections ()
int AIFirstPick ()
int AISecondPick ()
void AITurnHD ()
 Performs all actions made by the AI in the Hard Drive stage.
void AITurnCache ()
 Performs all actions made by the AI in the Cache stage.
void assignBoardData ()
 Randomly assigns appropriate data types to the registers on the current board.
int determineCol (int x)
int determineRow (int y)
int findPair (int currentPick)
void getMouseInfo ()
bool isMatch (int pick1, int pick2)
bool isValidClick ()
 Returns true if the player has clicked on an unselected register and false otherwise.
bool isValidPick (int row, int col)
 Returns true if the register selected by the AI was previously unselected, false otherwise.
void nextStage ()
 Performs all steps to reset the board for the next stage.
int pickRandomly ()
 Returns the location of a random, unselected register on the current board.
void resetBoardLayout ()
 Resets the board layout when a new stage is reached.
void setup ()
 Performs all steps of initially setting up the game board/displays.
void setBoard ()
 Creates a new MemBoard object whose size depends on the current difficulty.
void setBoardLayout ()
 Creates new MemRegister objects and adds them to the current board.
void setDisplay ()
 Creates a new MemDisplay object and adds it to the current board.
void setPairs ()
 Assigns the number of pairs that must be found, depending on difficulty.
string toBinary (int decimal, int digits)
 Returns the binary string value of the given decimal number, with the given number of digits.
void updateDisplayMap (int newMatch)
 Updates the MemDisplay object when a new match is made by the player.
void updateMessageBoard ()
 Updates the message board, dependant on the current game state.

Static Public Member Functions

static void defineNames ()

Protected Attributes

MemMessageBoardmessageBoard
 A message board to display messages to the user.
Layerbuffer
MemBoardboard
std::vector< MemRegister * > registers
 The registers.
MemDisplaydisplay
WaveSoundcorrectSound
WaveSoundincorrectSound
WaveSoundclickSound
Textmessages
int AIMatches
int AIPickChart [4][12]
int playerPickChart [4][12]
int AIPick1
int AIPick2
int difficultyLevel
int stage
int pairs
int pairLocation
int cursor_x
int cursor_y
int row
int rows
int col
int cols
int pick1Col
int pick1Row
int playerMatches
int regMax
int stepCount
int turn
int tempType
int tempColor
int validPicks
bool clicked
bool complete
string binaryRow
string binaryCol
string message
stringstream out1
stringstream out2

Static Private Attributes

static const int MEDXOFFSET = 50
static const int MEDYOFFSET = 75
static const int MEDINITX = 220
static const int MEDINITY = 205
static const int SMALLXOFFSET = 64
static const int SMALLINITX = 225
static const int SMALLINITY = 215
static const int SMALLYOFFSET = 105
static const int LARGEXOFFSET = 33
static const int LARGEYOFFSET = 53
static const int LARGEINITX = 220
static const int LARGEINITY = 212


Detailed Description

This is the gamecontroller subclass that controls the Memory Matching Minigame.

Constructor & Destructor Documentation

MemoryMatching::MemoryMatching ( int  diffLevel  ) 

MemoryMatching::~MemoryMatching (  )  [virtual]


Member Function Documentation

int MemoryMatching::AIFirstPick (  ) 

Returns the index number of AI's first pick. The pick is based on what the AI has seen in previous rounds.

int MemoryMatching::AISecondPick (  ) 

Returns the index number of AI's second pick. The pick is based on what the AI has seen in previous rounds.

void MemoryMatching::AITurnCache (  ) 

Performs all actions made by the AI in the Cache stage.

void MemoryMatching::AITurnHD (  ) 

Performs all actions made by the AI in the Hard Drive stage.

void MemoryMatching::assignBoardData (  ) 

Randomly assigns appropriate data types to the registers on the current board.

bool MemoryMatching::containsPoint ( Point  point  )  [virtual]

Reimplemented from MouseListener.

void MemoryMatching::defineNames (  )  [static]

int MemoryMatching::determineCol ( int  x  ) 

Given the x value of a click location, returns the column on the current board in which the click occurred.

int MemoryMatching::determineRow ( int  y  ) 

Given the y value of a click location, returns the row on the current board in which the click occurred.

void MemoryMatching::draw ( BITMAP *   )  [virtual]

This function will also be called each screen refresh to draw to the buffer.

Implements GameController.

int MemoryMatching::findPair ( int  currentPick  ) 

Returns the location of the register that contains the same data as the register at the location indicated by currentPick.

Graphic * MemoryMatching::getDirections (  )  [virtual]

Reimplemented from GameController.

void MemoryMatching::getMouseInfo (  ) 

bool MemoryMatching::isComplete (  )  [virtual]

This function can be called to check if the GameController is done.

Implements GameController.

bool MemoryMatching::isMatch ( int  pick1,
int  pick2 
)

Returns true if the registers located at pick1 and pick2 contain the same data, and belong to the player that picked them. False otherwise.

bool MemoryMatching::isValidClick (  ) 

Returns true if the player has clicked on an unselected register and false otherwise.

bool MemoryMatching::isValidPick ( int  row,
int  col 
)

Returns true if the register selected by the AI was previously unselected, false otherwise.

void MemoryMatching::mouseClick ( MouseEvent  )  [virtual]

Called when the mouse clicks on a MouseListener.

Reimplemented from MouseListener.

void MemoryMatching::nextStage (  ) 

Performs all steps to reset the board for the next stage.

int MemoryMatching::pickRandomly (  ) 

Returns the location of a random, unselected register on the current board.

void MemoryMatching::resetBoardLayout (  ) 

Resets the board layout when a new stage is reached.

void MemoryMatching::setBoard (  ) 

Creates a new MemBoard object whose size depends on the current difficulty.

void MemoryMatching::setBoardLayout (  ) 

Creates new MemRegister objects and adds them to the current board.

void MemoryMatching::setDisplay (  ) 

Creates a new MemDisplay object and adds it to the current board.

void MemoryMatching::setPairs (  ) 

Assigns the number of pairs that must be found, depending on difficulty.

void MemoryMatching::setup (  ) 

Performs all steps of initially setting up the game board/displays.

void MemoryMatching::step (  )  [virtual]

This function will be called each time unit of the game.

Implements GameController.

string MemoryMatching::toBinary ( int  decimal,
int  digits 
)

Returns the binary string value of the given decimal number, with the given number of digits.

void MemoryMatching::updateDisplayMap ( int  newMatch  ) 

Updates the MemDisplay object when a new match is made by the player.

void MemoryMatching::updateMessageBoard (  ) 

Updates the message board, dependant on the current game state.


Member Data Documentation

int MemoryMatching::AIMatches [protected]

int MemoryMatching::AIPick1 [protected]

int MemoryMatching::AIPick2 [protected]

int MemoryMatching::AIPickChart[4][12] [protected]

string MemoryMatching::binaryCol [protected]

string MemoryMatching::binaryRow [protected]

bool MemoryMatching::clicked [protected]

int MemoryMatching::col [protected]

int MemoryMatching::cols [protected]

bool MemoryMatching::complete [protected]

int MemoryMatching::cursor_x [protected]

int MemoryMatching::cursor_y [protected]

const int MemoryMatching::LARGEINITX = 220 [static, private]

const int MemoryMatching::LARGEINITY = 212 [static, private]

const int MemoryMatching::LARGEXOFFSET = 33 [static, private]

const int MemoryMatching::LARGEYOFFSET = 53 [static, private]

const int MemoryMatching::MEDINITX = 220 [static, private]

const int MemoryMatching::MEDINITY = 205 [static, private]

const int MemoryMatching::MEDXOFFSET = 50 [static, private]

const int MemoryMatching::MEDYOFFSET = 75 [static, private]

string MemoryMatching::message [protected]

A message board to display messages to the user.

stringstream MemoryMatching::out1 [protected]

stringstream MemoryMatching::out2 [protected]

int MemoryMatching::pairs [protected]

int MemoryMatching::pick1Col [protected]

int MemoryMatching::pick1Row [protected]

int MemoryMatching::playerPickChart[4][12] [protected]

std::vector<MemRegister*> MemoryMatching::registers [protected]

The registers.

int MemoryMatching::regMax [protected]

int MemoryMatching::row [protected]

int MemoryMatching::rows [protected]

const int MemoryMatching::SMALLINITX = 225 [static, private]

const int MemoryMatching::SMALLINITY = 215 [static, private]

const int MemoryMatching::SMALLXOFFSET = 64 [static, private]

const int MemoryMatching::SMALLYOFFSET = 105 [static, private]

int MemoryMatching::stage [protected]

int MemoryMatching::stepCount [protected]

int MemoryMatching::tempColor [protected]

int MemoryMatching::tempType [protected]

int MemoryMatching::turn [protected]

int MemoryMatching::validPicks [protected]


The documentation for this class was generated from the following files:

Generated on Mon Mar 16 14:33:13 2009 for LearningGaming by  doxygen 1.5.7.1