Problem with Load World / Agent...
This commit is contained in:
parent
da3a5d5948
commit
7c681d1dfd
|
|
@ -257,13 +257,24 @@ public class Simulator extends Thread {
|
|||
}
|
||||
|
||||
public ArrayList<String> getAgentsSave() {
|
||||
// TODO: Same idea as the other save method, but for agents
|
||||
return null;
|
||||
ArrayList<String> saveState = new ArrayList<>();
|
||||
for (Agent agent : agents) {
|
||||
saveState.add(agent.toString());
|
||||
}
|
||||
return saveState;
|
||||
}
|
||||
|
||||
public void loadAgents(ArrayList<String> stringArray) {
|
||||
// TODO: Same idea as other load methods, but for agent list
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public String clickActionName() {
|
||||
return clickActionFlag ? "sheep" : "cell";
|
||||
|
|
|
|||
Loading…
Reference in New Issue