wolf clikCell
This commit is contained in:
parent
444f3c2be7
commit
a6f75c507c
|
|
@ -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);
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Reference in New Issue