Life001 Class Reference

#include <Life001.h>

List of all members.

Public Member Functions

 Life001 ()
void run ()
 ~Life001 ()

Private Member Functions

void fill ()
void display ()
void calculate ()
void swap ()

Static Private Member Functions

static void wait ()
static void cls ()

Private Attributes

LifeMatrixfNow
LifeMatrixfFuture


Detailed Description

Definition at line 9 of file Life001.h.


Constructor & Destructor Documentation

Life001::Life001 (  ) 

Game of Life invented by John Horton Conway © Bernhard Wagner, 2003.

Definition at line 219 of file Life001.cpp.

Life001::~Life001 (  ) 

Definition at line 234 of file Life001.cpp.

References fFuture, and fNow.


Member Function Documentation

void Life001::run (  ) 

Runs the game.

Definition at line 224 of file Life001.cpp.

References calculate(), display(), fill(), LifeMatrix::initRand(), and wait().

Referenced by LifeExercise::execute().

void Life001::fill (  )  [inline, private]

Fills the LifeMatrix with initial setting.

Definition at line 242 of file Life001.cpp.

References LifeMatrix::fill(), and fNow.

Referenced by run().

void Life001::display (  )  [inline, private]

Clears screen and displays the current LifeMatrix on stdout.

Definition at line 249 of file Life001.cpp.

References cls(), LifeMatrix::display(), and fNow.

Referenced by run().

void Life001::calculate (  )  [inline, private]

Death if an occupied cell has 0, 1, 4, 5, 6, 7, or 8 occupied neighbours, the organism dies (0, 1 neighbors: of loneliness; 4 thru 8: of overcrowding). Survival if an occupied cell has two or three neighbours, the organism survives to the next generation. Birth If an unoccupied cell has three occupied neighbors, it becomes occupied.

Definition at line 261 of file Life001.cpp.

References LifeMatrix::countNeighbours(), LifeMatrix::enliven(), fFuture, fNow, LifeMatrix::isAlive(), LifeMatrix::kill(), SIZE_X, SIZE_Y, and swap().

Referenced by run().

void Life001::swap (  )  [inline, private]

Swap future and now. Comparable to double buffering for raster graphics.

Definition at line 282 of file Life001.cpp.

References fFuture, and fNow.

Referenced by calculate().

void Life001::wait (  )  [static, private]

Busy wait.

Definition at line 291 of file Life001.cpp.

Referenced by run().

void Life001::cls (  )  [static, private]

Wrapper for clear screen functionality.

Definition at line 298 of file Life001.cpp.

Referenced by display().


Member Data Documentation

LifeMatrix* Life001::fNow [private]

Definition at line 55 of file Life001.h.

Referenced by calculate(), display(), fill(), swap(), and ~Life001().

LifeMatrix* Life001::fFuture [private]

Definition at line 56 of file Life001.h.

Referenced by calculate(), swap(), and ~Life001().


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