in GameOfLife/ViewModel/PetriDish.cs [99:119]
private Cell GetNextGenerationCellUnoptimized(int i, int j) // UNOPTIMIZED
{
var cell = currentCells[i, j];
var isAlive = cell.IsAlive;
var neighborsCount = CountNeighbors(i, j);
if (isAlive && neighborsCount < 2)
return new Cell(0, false);
if (isAlive && (neighborsCount == 2 || neighborsCount == 3))
return new Cell(cell.Age + 1, true);
if (isAlive && neighborsCount > 3)
return new Cell(0, false);
if (!isAlive && neighborsCount == 3)
return new Cell(0, true);
return new Cell(0, false);
}