Skip to content
Snippets Groups Projects
Commit 9ac7c488 authored by Jan Grewe's avatar Jan Grewe
Browse files

fix cell count

parent 9b78b781
No related branches found
No related tags found
No related merge requests found
......@@ -83,9 +83,11 @@ void gameTick(bool (&a)[SCREEN_HEIGHT][SCREEN_WIDTH])
// else: right amount of neighbors -> stay alive
else
{
if (colorMap[row][col] < 255) {
if (colorMap[row][col] < 255)
{
colorMap[row][col]++;
}
cellsAliveNow++;
}
}
// cell was dead, but has right amount of neighbors now -> come alive
......@@ -149,11 +151,6 @@ void gameLoop()
else // not gameOver
{
if (currentTick % 2)
{
cellsAliveBefore = cellsAliveNow;
}
if (cellsAliveNow >= cellsAliveBefore - 5 &&
cellsAliveNow <= cellsAliveBefore + 5)
{
......@@ -164,6 +161,9 @@ void gameLoop()
noEvolutionTicks = 0;
}
cellsAliveBefore = cellsAliveNow;
if (noEvolutionTicks > noEvolutionTicksLimit)
{
finalTicks = currentTick - noEvolutionTicksLimit;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment