diff --git a/Grid.java b/Grid.java index 3bc067bf7bef2787a2171ce96cd76cc49c28d547..b0acf3cc4bb1f1c39f3f384da9a9110981089aec 100644 --- a/Grid.java +++ b/Grid.java @@ -103,7 +103,13 @@ public class Grid implements Iterable<Cell> { } private int countAliveNeighbours(int rowIndex, int columnIndex) { - return 0; + int aliveNeighbours = 0; + List<Cell> cells = getNeighbours(rowIndex, columnIndex); + for (Cell cell : cells) { + if (cell.isAlive()) + aliveNeighbours++; + } + return aliveNeighbours; }