some modifications
This commit is contained in:
parent
7c681d1dfd
commit
a0807f700c
|
|
@ -35,6 +35,10 @@ public abstract class Agent {
|
||||||
// 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);
|
||||||
|
|
||||||
|
public static Agent fromString(String line) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -120,6 +120,9 @@ public class Simulator extends Thread {
|
||||||
|
|
||||||
return aliveCount;
|
return aliveCount;
|
||||||
}
|
}
|
||||||
|
public void stopSimu() {
|
||||||
|
stopFlag=true;
|
||||||
|
}
|
||||||
|
|
||||||
public void togglePause() {
|
public void togglePause() {
|
||||||
pauseFlag = !pauseFlag;
|
pauseFlag = !pauseFlag;
|
||||||
|
|
@ -267,7 +270,6 @@ public class Simulator extends Thread {
|
||||||
public void loadAgents(ArrayList<String> stringArray) {
|
public void loadAgents(ArrayList<String> stringArray) {
|
||||||
agents.clear();
|
agents.clear();
|
||||||
for (String line : stringArray) {
|
for (String line : stringArray) {
|
||||||
// Assuming Agent class has a static method fromString to parse agent information
|
|
||||||
Agent agent = Agent.fromString(line);
|
Agent agent = Agent.fromString(line);
|
||||||
if (agent != null) {
|
if (agent != null) {
|
||||||
agents.add(agent);
|
agents.add(agent);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue