// class definition for a general Life simluator
#ifndef LIFE_H
#define LIFE_H

#include "Viewport.h"

class LifeSimulator
	{
public:
	// get value at cell (i,j)
	virtual unsigned char GetValue(int i, int j) const = 0;
	virtual void SetValue(int i, int j, unsigned char value) = 0;
	virtual void NextGeneration(void) = 0;
	virtual void SetSize(int width, int height) = 0;
	virtual void GetSize(int & width, int & height) const = 0;
	virtual bool GetWraparound(void) const = 0;
	virtual void SetWraparound(bool wrap) = 0;
	virtual __int64 GetPopulation(void) const = 0;
	virtual void SetPopulation(__int64 pop) = 0;
	virtual __int64 GetGeneration(void) = 0;
	virtual void Reset(void) = 0;
	virtual __int64 CountPopulation(void) = 0;
	virtual ~LifeSimulator(void) {};

	// call after setting values - converts to internal format
	virtual void ConvertToInternal(void) {};
	// call before drawing or reading values - converts internal to fast read format
	virtual void ConvertToExternal(void) {};

	// takes RGB buffer, stride, image width, height, and color to draw r,g,b
	// and viewport
	virtual void DrawBuffer(Viewport & vp, unsigned char * buffer, int stride, int width, int height,
					unsigned char r, unsigned char g, unsigned char b) = 0;

	// see if type needs to load from buffer instead of using SetValue in loop
	virtual bool UsesLoadBuffer(void) {return false; }
	virtual void LoadBuffer(unsigned char * buffer, int width, int height) {};

	}; // class LifeSimulator


#endif // LIFE_H
// end - Life.h