wolf clikCell

This commit is contained in:
Laure BEL 2024-05-30 10:13:27 +02:00
parent 444f3c2be7
commit a6f75c507c
2 changed files with 3 additions and 4 deletions

View File

@ -33,7 +33,7 @@ public abstract class Agent {
// Does whatever the agent does during a step
// then returns a boolean
// if false, agent dies at end of turn
// see step function in Simulator
// see step function in Simulator
public abstract boolean liveTurn(ArrayList<Agent> neighbors, Simulator world);

View File

@ -79,7 +79,6 @@ public class Simulator extends Thread {
System.out.println("wrong file buddy, this one's empty");
}else if(surviveCells.length<=0) {
System.out.println("wrong file buddy, this one's does not have survival rules, won't work");
return;
}else {
for (int x = 0; x < birthCells.length; x++) {
String elem = birthCells[x];
@ -295,8 +294,8 @@ public class Simulator extends Thread {
} else if (clickActionFlag==2) { // wolf
ArrayList<Agent> nearby=getNeighboringAnimals(x,y,1);
if (nearby.isEmpty()) {
Sheep sheep = new Sheep(x,y);
agents.add(sheep);
Wolf wolf = new Wolf(x,y);
agents.add(wolf);
}else {
for (Agent animal:nearby) {
agents.remove(animal);