Skip to content
Snippets Groups Projects
Commit 6a7d4c4e authored by AREZKI Celia's avatar AREZKI Celia
Browse files

BoardFireFighterBehavior : add the methode updateClouds

parent 23ee14fc
No related branches found
No related tags found
No related merge requests found
......@@ -121,5 +121,24 @@ public class BoardFireFighterBehavior implements BoardBehavior{
public void reset() {
this.step=0;
}
public List<Position> updateClouds() {
List<Position> modifiedPositions = new ArrayList<>();
List<Position> newCloudPositions = new ArrayList<>();
for (Position cloudPosition : cloudPositions) {
// Déplacement aléatoire
List<Position> possibleMoves = neighbors.get(cloudPosition);
Position newCloudPosition = possibleMoves.get(new Random().nextInt(possibleMoves.size()));
newCloudPositions.add(newCloudPosition);
// Éteindre le feu à la position du nuage
extinguish(newCloudPosition);
modifiedPositions.add(cloudPosition);
modifiedPositions.add(newCloudPosition);
}
cloudPositions = newCloudPositions;
return modifiedPositions;
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment