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
|
// Does whatever the agent does during a step
|
||||||
// then returns a boolean
|
// then returns a boolean
|
||||||
// if false, agent dies at end of turn
|
// 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);
|
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");
|
System.out.println("wrong file buddy, this one's empty");
|
||||||
}else if(surviveCells.length<=0) {
|
}else if(surviveCells.length<=0) {
|
||||||
System.out.println("wrong file buddy, this one's does not have survival rules, won't work");
|
System.out.println("wrong file buddy, this one's does not have survival rules, won't work");
|
||||||
return;
|
|
||||||
}else {
|
}else {
|
||||||
for (int x = 0; x < birthCells.length; x++) {
|
for (int x = 0; x < birthCells.length; x++) {
|
||||||
String elem = birthCells[x];
|
String elem = birthCells[x];
|
||||||
|
|
@ -295,8 +294,8 @@ public class Simulator extends Thread {
|
||||||
} else if (clickActionFlag==2) { // wolf
|
} else if (clickActionFlag==2) { // wolf
|
||||||
ArrayList<Agent> nearby=getNeighboringAnimals(x,y,1);
|
ArrayList<Agent> nearby=getNeighboringAnimals(x,y,1);
|
||||||
if (nearby.isEmpty()) {
|
if (nearby.isEmpty()) {
|
||||||
Sheep sheep = new Sheep(x,y);
|
Wolf wolf = new Wolf(x,y);
|
||||||
agents.add(sheep);
|
agents.add(wolf);
|
||||||
}else {
|
}else {
|
||||||
for (Agent animal:nearby) {
|
for (Agent animal:nearby) {
|
||||||
agents.remove(animal);
|
agents.remove(animal);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue