diff --git a/Grid.java b/Grid.java index b0acf3cc4bb1f1c39f3f384da9a9110981089aec..c69da33ee09eab130b063508dfb5654a350ea0f0 100644 --- a/Grid.java +++ b/Grid.java @@ -99,7 +99,11 @@ public class Grid implements Iterable<Cell> { } private boolean calculateNextState(int rowIndex, int columnIndex, Cell cell) { - return false; + int aliveNeighbours = countAliveNeighbours(rowIndex, columnIndex); + if (cell.isAlive()) { + return aliveNeighbours > 1 && aliveNeighbours < 4; + } + return aliveNeighbours == 3; } private int countAliveNeighbours(int rowIndex, int columnIndex) {