some modifications

This commit is contained in:
paull 2024-05-27 17:26:19 +02:00
parent 7c681d1dfd
commit a0807f700c
2 changed files with 7 additions and 1 deletions

View File

@ -36,5 +36,9 @@ public abstract class Agent {
// see step function in Simulator
public abstract boolean liveTurn(ArrayList<Agent> neighbors, Simulator world);
public static Agent fromString(String line) {
return null;
}
}

View File

@ -120,6 +120,9 @@ public class Simulator extends Thread {
return aliveCount;
}
public void stopSimu() {
stopFlag=true;
}
public void togglePause() {
pauseFlag = !pauseFlag;
@ -267,7 +270,6 @@ public class Simulator extends Thread {
public void loadAgents(ArrayList<String> stringArray) {
agents.clear();
for (String line : stringArray) {
// Assuming Agent class has a static method fromString to parse agent information
Agent agent = Agent.fromString(line);
if (agent != null) {
agents.add(agent);