I cant implement class GameOfLifes constructors and function

I can’t implement class GameOfLife’s constructors and functions . Could you help me with this? thank you.

//Cell definitions

Cell::Cell() { state = 0; }

Cell::Cell(bool state) { face = state; }

Cell::~Cell() {//deletes all dynamically allocated memory }

bool Cell::getState() const { return state; }

void Cell::setState(bool newState)

{ state = newState;

if (state == 0) face = dead;

else face = alive; }

char Cell::getFace() const { return face; }

class GameOfLife

{

public:

static const unsigned int MAX_BOARD = 30;

GameOfLife();

GameOfLife(size_t boardSize);

~GameOfLife();

int seedBoard(string fileName);

void seedBoard(size_t seeds);

void run();

void run(unsigned int numberOfIterations);

private:

bool executeRules(unsigned int countAlive, bool currentState);

// With \"Halo\" approach we need a bigger board

Cell currentLife[MAX_BOARD + 2][MAX_BOARD + 2];

Cell nextLife[MAX_BOARD + 2][MAX_BOARD + 2];

size_t boardSize; // Board size requested in the constructor

};

constructor implementation

GameOfLife::GameOfLife()

{

}

GameOfLife::GameOfLife(size_t boardSize)

{

for (int i=0; i> input;

currentLife[i][j].setState(input);

}

}

infile.close();

}

void GameOfLife::seedBoard(size_t seeds)

{

srand(time(NULL));

size_t count = 0;

while (count < seeds)

{

int randNumber1 = rand() % (26)+2;

int randNumber2 = rand() % (26)+2;

count++;

currentLife[randNumber1][randNumber2].setState(true);

}

}

Solution

//Cell definitions

Cell::Cell() { state = 0; }

Cell::Cell(bool state) { face = state; }

Cell::~Cell() {//deletes all dynamically allocated memory }

bool Cell::getState() const { return state; }

void Cell::setState(bool newState)

{ state = newState;

if (state == 0) face = dead;

else face = alive; }

char Cell::getFace() const { return face; }

class GameOfLife

{

public:

static const unsigned int MAX_BOARD = 30;

GameOfLife();

GameOfLife(size_t boardSize);

~GameOfLife();

int seedBoard(string fileName);

void seedBoard(size_t seeds);

void run();

void run(unsigned int numberOfIterations);

private:

bool executeRules(unsigned int countAlive, bool currentState);

// With \"Halo\" approach we need a bigger board

Cell currentLife[MAX_BOARD + 2][MAX_BOARD + 2];

Cell nextLife[MAX_BOARD + 2][MAX_BOARD + 2];

size_t boardSize; // Board size requested in the constructor

};

constructor implementation

GameOfLife::GameOfLife()

{

}

GameOfLife::GameOfLife(size_t boardSize)

{

for (int i=0; i> input;

currentLife[i][j].setState(input);

}

}

infile.close();

}

void GameOfLife::seedBoard(size_t seeds)

{

srand(time(NULL));

size_t count = 0;

while (count < seeds)

{

int randNumber1 = rand() % (26)+2;

int randNumber2 = rand() % (26)+2;

count++;

currentLife[randNumber1][randNumber2].setState(true);

}

}

I can’t implement class GameOfLife’s constructors and functions . Could you help me with this? thank you. //Cell definitions Cell::Cell() { state = 0; } Cell::C
I can’t implement class GameOfLife’s constructors and functions . Could you help me with this? thank you. //Cell definitions Cell::Cell() { state = 0; } Cell::C
I can’t implement class GameOfLife’s constructors and functions . Could you help me with this? thank you. //Cell definitions Cell::Cell() { state = 0; } Cell::C
I can’t implement class GameOfLife’s constructors and functions . Could you help me with this? thank you. //Cell definitions Cell::Cell() { state = 0; } Cell::C

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site