Skip to content
Snippets Groups Projects
Commit afc7b317 authored by LABOUREL Arnaud's avatar LABOUREL Arnaud
Browse files

mise à jour 2022

parent 0b05b409
No related branches found
No related tags found
No related merge requests found
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: before_script:
- export GRADLE_USER_HOME=`pwd`/.gradle - GRADLE_USER_HOME="$(pwd)/.gradle"
- export GRADLE_USER_HOME
cache: build:
paths: stage: build
- .gradle/wrapper script: gradle --build-cache assemble
- .gradle/caches cache:
key: "$CI_COMMIT_REF_NAME"
policy: push
paths:
- build
- .gradle
java: test:
stage: test stage: test
script: script: gradle check
- gradle test cache:
artifacts: key: "$CI_COMMIT_REF_NAME"
when: always policy: pull
reports: paths:
junit: build/test-results/test/**/TEST-*.xml - build
\ No newline at end of file - .gradle
...@@ -12,7 +12,8 @@ Le jeu se déroule sur une grille à deux dimensions dont les cases qu’on appe ...@@ -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. - 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. 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 ## Membre du projet
- NOM, prénom, numéro de groupe, du deuxième participant
- NOM, prénom, du participant
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists 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 zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists
...@@ -30,15 +30,6 @@ public class Cell { ...@@ -30,15 +30,6 @@ public class Cell {
getStateProperty().setValue(cellState); 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}. * Returns the current state of this {@link Cell}.
* *
......
...@@ -6,7 +6,8 @@ import javafx.scene.paint.Color; ...@@ -6,7 +6,8 @@ import javafx.scene.paint.Color;
* {@link CellState} instances represent the possible states of a {@link CellState}. * {@link CellState} instances represent the possible states of a {@link CellState}.
*/ */
public enum 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 boolean isAlive;
public final Color color; public final Color color;
......
...@@ -31,16 +31,16 @@ public class GridTest { ...@@ -31,16 +31,16 @@ public class GridTest {
@Test @Test
public void testCountAliveNeighbours() { public void testCountAliveNeighbours() {
assertThat(grid.countAliveNeighbors(1, 1)).isEqualTo(0); assertThat(grid.countAliveNeighbors(1, 1)).isEqualTo(0);
grid.getCell(2, 2).setAlive(); grid.getCell(2, 2).setState(CellState.ALIVE);
grid.getCell(0, 0).setAlive(); grid.getCell(0, 0).setState(CellState.ALIVE);
assertThat(grid.countAliveNeighbors(1, 1)).isEqualTo(2); assertThat(grid.countAliveNeighbors(1, 1)).isEqualTo(2);
} }
@Test @Test
public void testCalculateNextState() { public void testCalculateNextState() {
grid.getCell(1, 0).setAlive(); grid.getCell(1, 0).setState(CellState.ALIVE);
grid.getCell(1, 1).setAlive(); grid.getCell(1, 1).setState(CellState.ALIVE);
grid.getCell(1, 2).setAlive(); grid.getCell(1, 2).setState(CellState.ALIVE);
assertThat(grid.calculateNextState(0, 0).isAlive).isFalse(); assertThat(grid.calculateNextState(0, 0).isAlive).isFalse();
assertThat(grid.calculateNextState(1, 0).isAlive).isFalse(); assertThat(grid.calculateNextState(1, 0).isAlive).isFalse();
assertThat(grid.calculateNextState(1, 1).isAlive).isTrue(); assertThat(grid.calculateNextState(1, 1).isAlive).isTrue();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment