#ifndef __GAMEOFLIFE_H
#define __GAMEOFLIFE_H

/////////////////////////////////////////////////////////////////////////
//
// Name:	GameOfLife.h
//
// Purpose:	Class for John Horton Conway's "Game of Life"
//			Cellular Automata
//
/////////////////////////////////////////////////////////////////////////

#include "CellularAutomata2D.h"


class GameOfLife : public CellularAutomata2D {

public:

	//
	// Default constructor
	//
	GameOfLife(
	const Iteration_t&	i=DEFAULT_ITERATIONS,
	const Dimension_t&	r=DEFAULT_DIMENSION,
	const Dimension_t&	c=DEFAULT_DIMENSION,
	const int&			inverseProbability=10) :
		CellularAutomata2D(i, r, c)
			{ Randomize(inverseProbability); } // Randomly seed lattice


	//
	// Copy constructor
	//
	GameOfLife(
	const GameOfLife& C) :
		CellularAutomata2D(C) {}


	//
	// Overloaded assignment operator
	//
	GameOfLife&
	operator=(
		const GameOfLife& C)
			{
				if (this != &C) {
					delete this;
					CellularAutomata2D::operator=(C);
				}
				return *this;
			}


	//
	// Destructor
	//
	~GameOfLife() {}


	//
	//	Applies the 2D cellular automata rules defined by
	//	John Horton Conway, commonly referred to as the
	//	"game of life," to each cell in the 2D lattice.
	//
	Status_t
	ApplyRules();


	//
	//	Assigns the state of random cells in the 2D lattice
	//	to the alive state based on the probability conferred
	//	by invP.
	//
	void
	Randomize(const int&);

protected:

private:

};

#endif // __GAMEOFLIFE_H
