From 18d9a2dad5f16fb4e6662815fe0850d51cf08770 Mon Sep 17 00:00:00 2001
From: Mathias <mathias.faure@etu.univ-amu.fr>
Date: Tue, 6 Oct 2020 09:47:26 +0200
Subject: [PATCH] =?UTF-8?q?Tout=20le=20TP=20termin=C3=A9.?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 Cell.java |  2 +-
 Grid.java | 11 +++++++----
 2 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/Cell.java b/Cell.java
index 4ace922..d91aeae 100644
--- a/Cell.java
+++ b/Cell.java
@@ -5,7 +5,7 @@
 public class Cell {
     private boolean isAlive;
 
-    private String color = "Blue";
+    private String color = "Red";
 
     public Cell(){
 	this.isAlive = false;
diff --git a/Grid.java b/Grid.java
index e8a18d2..6806860 100644
--- a/Grid.java
+++ b/Grid.java
@@ -120,9 +120,11 @@ public class Grid implements Iterable<Cell> {
 
     private boolean calculateNextState(int rowIndex, int columnIndex, Cell cell) {
         boolean Nextstate = cell.isAliveInNextState(this.countAliveNeighbours(rowIndex, columnIndex));
-        if (Nextstate) {
-            cell.setColor(this.countColorNeighbours(rowIndex, columnIndex));
-        }
+            if (Nextstate) {
+                if (this.countAliveNeighbours(rowIndex, columnIndex) != 2) {
+                    cell.setColor(this.countColorNeighbours(rowIndex, columnIndex));
+                }
+            }
 
         return Nextstate;
     }
@@ -152,13 +154,14 @@ public class Grid implements Iterable<Cell> {
             }
         }
 
-        if (Red>=Blue) {
+        if (Red>Blue) {
             CounterColorCell="Red";
         }
         else {
             CounterColorCell="Blue";
         }
 
+
         return CounterColorCell;
     }
 
-- 
GitLab