From ef5614843d143abfc178763de76203a0aad11a00 Mon Sep 17 00:00:00 2001
From: s23026062 <melis-damla.sahin@etu.univ-amu.fr>
Date: Tue, 26 Nov 2024 14:26:09 +0100
Subject: [PATCH] =?UTF-8?q?ajout=C3=A9=20la=20correction=20avec=20if=20aus?=
 =?UTF-8?q?si?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../java/model/automata/GameOfLifeState.java  | 24 +++++++++++++++----
 1 file changed, 19 insertions(+), 5 deletions(-)

diff --git a/src/main/java/model/automata/GameOfLifeState.java b/src/main/java/model/automata/GameOfLifeState.java
index 74a2a54..e47516c 100644
--- a/src/main/java/model/automata/GameOfLifeState.java
+++ b/src/main/java/model/automata/GameOfLifeState.java
@@ -14,15 +14,23 @@ public enum GameOfLifeState implements State<GameOfLifeState> {
 
     @Override
     public Color getColor() {
-        switch(this) {
+        switch (this) {
             case ALIVE:
                 return Color.RED;
-            case DEAD :
+            case DEAD:
+                return Color.WHITE;
+            default:
                 return Color.WHITE;
-            default : return Color.WHITE;
         }
     }
 
+    /* correction avec if :
+    if this.equals(ALIVE) {
+        return COLOR.RED;
+    else {
+        return COLOR.WHITE;
+    */
+
     @Override
     public GameOfLifeState next() {
         switch (this) {
@@ -30,9 +38,16 @@ public enum GameOfLifeState implements State<GameOfLifeState> {
                 return DEAD;
             case DEAD:
                 return ALIVE;
-            default : return DEAD;
+            default:
+                return DEAD;
         }
     }
+    /* correction avec if :
+        if this.equals(ALIVE) {
+            return DEAD;
+        else {
+            return ALIVE;
+        */
 
     @Override
     public GameOfLifeState update(List<GameOfLifeState> neighbours) {
@@ -54,4 +69,3 @@ public enum GameOfLifeState implements State<GameOfLifeState> {
         return DEAD;
     }
 }
-
-- 
GitLab