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 |
Definition at line 88 of file Life001.cpp.
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().
Counts the neighbours of the cell given by x and y.
x | xcoordinate of the cell of which to count the neighbours. | |
y | xcoordinate of the cell of which to count the neighbours. |
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().
Kills the element at the given corodinates.
x | xcoordinate of the cell to kill. | |
y | ycoordinate of the cell to kill. |
Definition at line 145 of file Life001.cpp.
Referenced by Life001::calculate().
Enlivens the element at the given coordinates.
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().
Indicates whether the element at the given coordinates is alive.
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.
char LifeMatrix::fillSquare58 | ( | int | x, | |
int | y | |||
) | [inline, private] |
Fills the LifeMatrix with a square pattern.
Definition at line 188 of file Life001.cpp.
char LifeMatrix::fillLine | ( | int | x, | |
int | y | |||
) | [inline, private] |
Fills the LifeMatrix with a line pattern.
Definition at line 195 of file Life001.cpp.
char LifeMatrix::fillGlider | ( | int | x, | |
int | y | |||
) | [inline, private] |
Fills the LifeMatrix with the Glider pattern.
Definition at line 202 of file Life001.cpp.
Referenced by fill().
lifeMatrix_t LifeMatrix::fMatrix [private] |