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

Life Class Reference

List of all members.

Public Methods

 Life ()
void run ()
 ~Life ()

Private Methods

void Life::fill ()
void Life::display ()
void calculate ()
void Life::swap ()

Static Private Methods

void Life::wait ()
void Life::cls ()

Private Attributes

LifeMatrixfNow
LifeMatrixfFuture

Detailed Description

Game of Life invented by John Horton Conway © Bernhard Wagner, bw@xmlizer.biz, 2003.

Definition at line 216 of file LifeExercise.cpp.


Constructor & Destructor Documentation

Life::Life   [inline]
 

Definition at line 218 of file LifeExercise.cpp.

References fFuture, and fNow.

Life::~Life   [inline]
 

Definition at line 233 of file LifeExercise.cpp.

References fFuture, and fNow.


Member Function Documentation

void Life::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 LifeExercise.cpp.

References ModN::completed(), SIZE_X, and SIZE_Y.

Referenced by run().

void Life::Life::cls   [inline, static, private]
 

Wrapper for clear screen functionality.

Definition at line 298 of file LifeExercise.cpp.

void Life::Life::display   [inline, private]
 

Clears screen and displays the current LifeMatrix on stdout.

Definition at line 249 of file LifeExercise.cpp.

References LifeMatrix::display(), and fNow.

void Life::Life::fill   [inline, private]
 

Fills the LifeMatrix with initial setting.

Definition at line 242 of file LifeExercise.cpp.

References LifeMatrix::fill(), fNow, and Life::fill().

Referenced by Life::fill().

void Life::Life::swap   [inline, private]
 

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

Definition at line 282 of file LifeExercise.cpp.

References fFuture, and fNow.

void Life::Life::wait   [inline, static, private]
 

Busy wait.

Definition at line 291 of file LifeExercise.cpp.

void Life::run   [inline]
 

Runs the game.

Definition at line 223 of file LifeExercise.cpp.

References calculate(), and LifeMatrix::initRand().

Referenced by LifeExercise::execute().


Member Data Documentation

LifeMatrix* Life::fFuture [private]
 

Definition at line 303 of file LifeExercise.cpp.

Referenced by Life(), Life::swap(), and ~Life().

LifeMatrix* Life::fNow [private]
 

Definition at line 302 of file LifeExercise.cpp.

Referenced by Life(), Life::display(), Life::fill(), Life::swap(), and ~Life().


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