Main Page   Namespace List   Class Hierarchy   Compound List   File List   Compound Members   File Members  

LifeMatrix Class Reference

List of all members.

Public Methods

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 Methods

void initRand ()

Private Methods

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, bw@xmlizer.biz, 2003.

Definition at line 85 of file LifeExercise.cpp.


Member Function Documentation

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 108 of file LifeExercise.cpp.

References isAlive().

void LifeMatrix::display   const [inline]
 

Displays the LifeMatrix on stdout.

Definition at line 90 of file LifeExercise.cpp.

References fMatrix, SIZE_X, and SIZE_Y.

Referenced by Life::Life::display().

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

Enlivens the element at the given corodinates.

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

Definition at line 151 of file LifeExercise.cpp.

References ALIVE, and fMatrix.

void LifeMatrix::fill   [inline]
 

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

Definition at line 129 of file LifeExercise.cpp.

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

Referenced by Life::Life::fill().

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

Fills the LifeMatrix with the Glider pattern.

Definition at line 199 of file LifeExercise.cpp.

References ALIVE, and DEAD.

Referenced by fill().

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

Fills the LifeMatrix with a line pattern.

Definition at line 192 of file LifeExercise.cpp.

References ALIVE, and DEAD.

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

Fills the LifeMatrix with a random pattern.

Definition at line 178 of file LifeExercise.cpp.

References ALIVE, and DEAD.

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

Fills the LifeMatrix with a square pattern.

Definition at line 185 of file LifeExercise.cpp.

References ALIVE, and DEAD.

void LifeMatrix::initRand   [inline, static]
 

Seeds the random number generator.

Definition at line 167 of file LifeExercise.cpp.

Referenced by Life::run().

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

Indicates whether the element at the given corodinates is alive.

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

Definition at line 160 of file LifeExercise.cpp.

References ALIVE, and fMatrix.

Referenced by countNeighbours().

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 142 of file LifeExercise.cpp.

References DEAD, and fMatrix.


Member Data Documentation

lifeMatrix_t LifeMatrix::fMatrix [private]
 

Definition at line 209 of file LifeExercise.cpp.

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


The documentation for this class was generated from the following file:
Generated on Sat Jul 19 18:19:55 2003 for Exercise Framework by doxygen1.2.18