Skip to content
Snippets Groups Projects
Commit cb4d18d9 authored by ousseyn01's avatar ousseyn01
Browse files

Implementation of methods for apply those methods

parent 004aad73
Branches
No related tags found
No related merge requests found
......@@ -121,7 +121,7 @@ public class FirefighterBoard implements Board<List<ModelElement>> {
public List<Position> updateToNextGeneration() {
List<Position> modifiedPositions = updateFirefighters();
if (step % 2 == 0){
modifiedPositions.addAll(fire.spreadFire());
modifiedPositions.addAll(fire.spreadFire(getMountainPositions()));
}
// Déplacer les nuages et éteindre les feux
for (Cloud cloud : clouds) {
......@@ -132,6 +132,13 @@ public class FirefighterBoard implements Board<List<ModelElement>> {
return modifiedPositions;
}
private Set<Position> getMountainPositions() {
Set<Position> mountainPositions = new HashSet<>();
for (Mountain mountain : mountains) {
mountainPositions.add(mountain.getPosition());
}
return mountainPositions;
}
@Override
public int stepNumber() {
......@@ -144,7 +151,7 @@ public class FirefighterBoard implements Board<List<ModelElement>> {
modifiedPosition.add(firefighter.getPosition());
Position newPosition = firefighter.moveToBestPosition(targetStrategy, fire.getFirePositions(), neighbors);
Position newPosition = firefighter.moveToBestPosition(fire.getFirePositions(), neighbors, getMountainPositions());
firefighter.setPosition(newPosition);
modifiedPosition.add(newPosition);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment