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

mise à jour 2022

parent 0b05b409
Branches
Tags
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:
- 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
......@@ -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
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
......@@ -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}.
*
......
......@@ -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;
......
......@@ -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();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment