LifeMatrix Class Reference

List of all members.

Public Member Functions

void display () const
int countNeighbours (const ModN &x, const ModN &y) const
void fill ()
void kill (const ModN &i, const ModN &j)
void enliven (const ModN &x, const ModN &y)
bool isAlive (const ModN &x, const ModN &y) const

Static Public Member Functions

static void initRand ()

Private Member Functions

char fillRand (int x, int y)
char fillSquare58 (int x, int y)
char fillLine (int x, int y)
char fillGlider (int x, int y)

Private Attributes

lifeMatrix_t fMatrix

Detailed Description

LifeMatrix. © Bernhard Wagner, 2003.

Definition at line 88 of file Life001.cpp.


Member Function Documentation

void LifeMatrix::display (  )  const [inline]

Displays the LifeMatrix on stdout.

Definition at line 93 of file Life001.cpp.

References fMatrix, SIZE_X, and SIZE_Y.

Referenced by Life001::display().

int LifeMatrix::countNeighbours ( const ModN x,
const ModN y 
) const [inline]

Counts the neighbours of the cell given by x and y.

Parameters:
x xcoordinate of the cell of which to count the neighbours.
y xcoordinate of the cell of which to count the neighbours.
Returns:
The number of neighbours of the cell given by x and y.

Definition at line 111 of file Life001.cpp.

References isAlive().

Referenced by Life001::calculate().

void LifeMatrix::fill (  )  [inline]

Fills the LifeMatrix with a certain pattern. You can choose between fillRand, fillSquare58, fillLine, fillGlider

Definition at line 132 of file Life001.cpp.

References fillGlider(), fMatrix, SIZE_X, and SIZE_Y.

Referenced by Life001::fill().

void LifeMatrix::kill ( const ModN i,
const ModN j 
) [inline]

Kills the element at the given corodinates.

Parameters:
x xcoordinate of the cell to kill.
y ycoordinate of the cell to kill.

Definition at line 145 of file Life001.cpp.

References DEAD, and fMatrix.

Referenced by Life001::calculate().

void LifeMatrix::enliven ( const ModN x,
const ModN y 
) [inline]

Enlivens the element at the given coordinates.

Parameters:
x xcoordinate of the cell to enliven.
y ycoordinate of the cell to enliven.

Definition at line 154 of file Life001.cpp.

References ALIVE, and fMatrix.

Referenced by Life001::calculate().

bool LifeMatrix::isAlive ( const ModN x,
const ModN y 
) const [inline]

Indicates whether the element at the given coordinates is alive.

Parameters:
x xcoordinate of the cell to check.
y ycoordinate of the cell to check.

Definition at line 163 of file Life001.cpp.

References ALIVE, and fMatrix.

Referenced by Life001::calculate(), and countNeighbours().

static void LifeMatrix::initRand (  )  [inline, static]

Seeds the random number generator.

Definition at line 170 of file Life001.cpp.

Referenced by Life001::run().

char LifeMatrix::fillRand ( int  x,
int  y 
) [inline, private]

Fills the LifeMatrix with a random pattern.

Definition at line 181 of file Life001.cpp.

References ALIVE, and DEAD.

char LifeMatrix::fillSquare58 ( int  x,
int  y 
) [inline, private]

Fills the LifeMatrix with a square pattern.

Definition at line 188 of file Life001.cpp.

References ALIVE, and DEAD.

char LifeMatrix::fillLine ( int  x,
int  y 
) [inline, private]

Fills the LifeMatrix with a line pattern.

Definition at line 195 of file Life001.cpp.

References ALIVE, and DEAD.

char LifeMatrix::fillGlider ( int  x,
int  y 
) [inline, private]

Fills the LifeMatrix with the Glider pattern.

Definition at line 202 of file Life001.cpp.

References ALIVE, and DEAD.

Referenced by fill().


Member Data Documentation

lifeMatrix_t LifeMatrix::fMatrix [private]

Definition at line 212 of file Life001.cpp.

Referenced by display(), enliven(), fill(), isAlive(), and kill().


The documentation for this class was generated from the following file:
Generated on Thu Jul 3 19:12:45 2008 for Exercise Framework by  doxygen 1.5.1