Skip to content
Snippets Groups Projects
Commit 8fc54d75 authored by BELHACHEMI Mehdi's avatar BELHACHEMI Mehdi
Browse files

mehdi : modifiying initializeElements() method

parent 3e4b0ab5
No related branches found
No related tags found
No related merge requests found
......@@ -16,5 +16,7 @@ public class Fire {
this.firePositions = postion;
}
public Position getFirePosition() {
return firePositions;
}
}
......@@ -18,6 +18,7 @@ public class FireFighter {
this.FireFighterPosition = postion;
}
public Position getFireFighterPosition() {
return FireFighterPosition;
}
}
......@@ -57,11 +57,15 @@ public class FirefighterBoard implements Board<List<ModelElement>> {
@Override
public List<ModelElement> getState(Position position) {
List<ModelElement> result = new ArrayList<>();
for (Position firefighterPosition : firefighterPositions)
if (firefighterPosition.equals(position))
for (FireFighter firefighter : firefighter)
if (firefighter.getFireFighterPosition().equals(position))
result.add(ModelElement.FIREFIGHTER);
if (firePositions.contains(position))
for(Fire fire : fire){
if(fire.getFirePosition().equals(position)){
result.add(ModelElement.FIRE);
}
}
return result;
}
......@@ -86,7 +90,7 @@ public class FirefighterBoard implements Board<List<ModelElement>> {
List<Position> modifiedPositions = new ArrayList<>();
if (step % 2 == 0) {
List<Position> newFirePositions = new ArrayList<>();
for (Position fire : firePositions) {
for (Fire fire : fires) {
newFirePositions.addAll(neighbors.get(fire));
}
firePositions.addAll(newFirePositions);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment