private int GetAliveNeighbours(Cell cell) { return CurrentGeneration.Count(neighbour => ((((Math.Abs(cell.X - neighbour.X) <= 1) && (Math.Abs(cell.Y - neighbour.Y) <= 1)) && (neighbour.CellValue == CellValue.Alive)) && (cell != neighbour))); }
private bool AliveCellWillSurvive(Cell cell) { return (cell.CellValue == CellValue.Alive && (GetAliveNeighbours(cell) == 2 || (GetAliveNeighbours(cell) == 3))); }
private bool DeadCellWillBeReborn(Cell cell) { return (cell.CellValue == CellValue.Dead && (GetAliveNeighbours(cell) == 3 || GetAliveNeighbours(cell) == 6)); }
private bool AliveCellDies(Cell cell) { return (cell.CellValue == CellValue.Alive && ((GetAliveNeighbours(cell) >= 4) || (GetAliveNeighbours(cell) <= 1))) ; }