From afc7b3179a87eeb8cb5dba074a160bc984bc89e6 Mon Sep 17 00:00:00 2001
From: arnaudlabourel <arnaud.labourel@univ-amu.fr>
Date: Tue, 30 Aug 2022 11:07:13 +0200
Subject: [PATCH] =?UTF-8?q?mise=20=C3=A0=20jour=202022?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .gitlab-ci.yml                           | 51 ++++++++++++++++++------
 README.md                                |  7 ++--
 gradle/wrapper/gradle-wrapper.properties |  2 +-
 src/main/java/model/Cell.java            |  9 -----
 src/main/java/model/CellState.java       |  3 +-
 src/test/java/model/GridTest.java        | 10 ++---
 6 files changed, 50 insertions(+), 32 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 406cf2c..10c5af6 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -1,18 +1,43 @@
-image: gradle:jdk16
+# To contribute improvements to CI/CD templates, please follow the Development guide at:
+# https://docs.gitlab.com/ee/development/cicd/templates.html
+# This specific template is located at:
+# https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/ci/templates/Gradle.gitlab-ci.yml
+
+# This is the Gradle build system for JVM applications
+# https://gradle.org/
+# https://github.com/gradle/gradle
+
+image: gradle:alpine
+
+# Disable the Gradle daemon for Continuous Integration servers as correctness
+# is usually a priority over speed in CI environments. Using a fresh
+# runtime for each build is more reliable since the runtime is completely
+# isolated from any previous builds.
+variables:
+  GRADLE_OPTS: "-Dorg.gradle.daemon=false"
 
 before_script:
-  - export GRADLE_USER_HOME=`pwd`/.gradle
+  - GRADLE_USER_HOME="$(pwd)/.gradle"
+  - export GRADLE_USER_HOME
 
-cache:
-  paths:
-    - .gradle/wrapper
-    - .gradle/caches
+build:
+  stage: build
+  script: gradle --build-cache assemble
+  cache:
+    key: "$CI_COMMIT_REF_NAME"
+    policy: push
+    paths:
+      - build
+      - .gradle
 
-java:
+test:
   stage: test
-  script:
-    - gradle test
-  artifacts:
-    when: always
-    reports:
-      junit: build/test-results/test/**/TEST-*.xml
\ No newline at end of file
+  script: gradle check
+  cache:
+    key: "$CI_COMMIT_REF_NAME"
+    policy: pull
+    paths:
+      - build
+      - .gradle
+
+
diff --git a/README.md b/README.md
index 5432785..a6b76db 100644
--- a/README.md
+++ b/README.md
@@ -12,7 +12,8 @@ Le jeu se déroule sur une grille à deux dimensions dont les cases qu’on appe
 - Une cellule vivante possédant deux ou trois voisines vivantes le reste, sinon elle meurt.
 
 Le but de ce TP est de compléter le code fourni par le dépôt afin d'obtenir un simulateur de jeu de la vie.
-## Membres du projet
 
-- NOM, prénom, numéro de groupe, du premier participant
-- NOM, prénom, numéro de groupe, du deuxième participant
+## Membre du projet
+
+- NOM, prénom, du participant
+
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
index 69a9715..ae04661 100644
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -1,5 +1,5 @@
 distributionBase=GRADLE_USER_HOME
 distributionPath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-7.1-bin.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip
 zipStoreBase=GRADLE_USER_HOME
 zipStorePath=wrapper/dists
diff --git a/src/main/java/model/Cell.java b/src/main/java/model/Cell.java
index abf8cb1..b8d733d 100644
--- a/src/main/java/model/Cell.java
+++ b/src/main/java/model/Cell.java
@@ -30,15 +30,6 @@ public class Cell {
         getStateProperty().setValue(cellState);
     }
 
-    /**
-     * Sets the state of this {@link Cell} to an arbitrary alive state.
-     */
-
-    public void setAlive() {
-        getStateProperty().setValue(CellState.ALIVE);
-    }
-
-
     /**
      * Returns the current state of this {@link Cell}.
      *
diff --git a/src/main/java/model/CellState.java b/src/main/java/model/CellState.java
index bb1edb3..2744b56 100644
--- a/src/main/java/model/CellState.java
+++ b/src/main/java/model/CellState.java
@@ -6,7 +6,8 @@ import javafx.scene.paint.Color;
  * {@link CellState} instances represent the possible states of a {@link CellState}.
  */
 public enum CellState {
-    ALIVE(true, Color.RED), DEAD(false, Color.WHITE);
+    ALIVE(true, Color.RED),
+    DEAD(false, Color.WHITE);
 
     public final boolean isAlive;
     public final Color color;
diff --git a/src/test/java/model/GridTest.java b/src/test/java/model/GridTest.java
index 9ae2d79..56e1d97 100644
--- a/src/test/java/model/GridTest.java
+++ b/src/test/java/model/GridTest.java
@@ -31,16 +31,16 @@ public class GridTest {
   @Test
   public void testCountAliveNeighbours() {
     assertThat(grid.countAliveNeighbors(1, 1)).isEqualTo(0);
-    grid.getCell(2, 2).setAlive();
-    grid.getCell(0, 0).setAlive();
+    grid.getCell(2, 2).setState(CellState.ALIVE);
+    grid.getCell(0, 0).setState(CellState.ALIVE);
     assertThat(grid.countAliveNeighbors(1, 1)).isEqualTo(2);
   }
 
   @Test
   public void testCalculateNextState() {
-    grid.getCell(1, 0).setAlive();
-    grid.getCell(1, 1).setAlive();
-    grid.getCell(1, 2).setAlive();
+    grid.getCell(1, 0).setState(CellState.ALIVE);
+    grid.getCell(1, 1).setState(CellState.ALIVE);
+    grid.getCell(1, 2).setState(CellState.ALIVE);
     assertThat(grid.calculateNextState(0, 0).isAlive).isFalse();
     assertThat(grid.calculateNextState(1, 0).isAlive).isFalse();
     assertThat(grid.calculateNextState(1, 1).isAlive).isTrue();
-- 
GitLab