From f5d3b3f99205b14f82b9ae6bfb3a2398876d1f0f Mon Sep 17 00:00:00 2001
From: arthur <c19222814>
Date: Tue, 6 Oct 2020 20:07:10 +0200
Subject: [PATCH] =?UTF-8?q?impl=C3=A9mentation=20de=20la=20m=C3=A9thode=20?=
 =?UTF-8?q?countAliveNeighbours?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 Grid.java | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/Grid.java b/Grid.java
index 3bc067b..b0acf3c 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;
     }
 
 
-- 
GitLab