Skip to content
Snippets Groups Projects
Commit 288f2cf8 authored by CHERCHEM Sarah's avatar CHERCHEM Sarah
Browse files

delete of some unused classes

parent 75b3606a
No related branches found
No related tags found
No related merge requests found
Showing
with 0 additions and 52 deletions
File deleted
File deleted
File deleted
File deleted
File deleted
File deleted
File deleted
File deleted
File deleted
package controller;
import util.Position;
import view.ViewElement;
import java.util.*;
public class CloudController {
private final int rowCount;
private final int columnCount;
private final Set<Position> clouds = new HashSet<>();
public CloudController(int rowCount, int columnCount) {
this.rowCount = rowCount;
this.columnCount = columnCount;
}
public void addCloud(Position position) {
clouds.add(position);
}
public Set<Position> getCloudPositions() {
return clouds;
}
public void moveClouds() {
Set<Position> newCloudPositions = new HashSet<>();
Random random = new Random();
for (Position cloud : clouds) {
int newRow = cloud.row() + random.nextInt(3) - 1; // Mouvement aléatoire (-1, 0, 1)
int newCol = cloud.column() + random.nextInt(3) - 1;
// S'assurer que les nuages restent dans les limites de la grille
newRow = Math.max(0, Math.min(rowCount - 1, newRow));
newCol = Math.max(0, Math.min(columnCount - 1, newCol));
newCloudPositions.add(new Position(newRow, newCol));
}
clouds.clear();
clouds.addAll(newCloudPositions);
}
public void extinguishFires(ViewElement[][] grid) {
for (Position cloud : clouds) {
if (grid[cloud.row()][cloud.column()] == ViewElement.FIRE) {
grid[cloud.row()][cloud.column()] = ViewElement.EMPTY; // Éteindre le feu
}
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment