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

---
 Grid.java | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/Grid.java b/Grid.java
index b0acf3c..c69da33 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) {
-- 
GitLab