getAgentsSave

This commit is contained in:
benoi 2024-05-29 16:06:56 +02:00
parent 4d7f223e9d
commit 1c69102be1
1 changed files with 12 additions and 2 deletions

View File

@ -413,8 +413,18 @@ public class Simulator extends Thread {
public ArrayList<String> getAgentsSave() {
//TODO : Same idea as the other save method, but for agents
return null;
ArrayList<String> agentsSave = new ArrayList<>();
for (int j = 0; j < getHeight(); j++) {
StringBuilder lineState = new StringBuilder();
for (int i = 0 ; i < getWidth() ; i++) {
lineState.append(getCell(i, j));
if (j < getHeight() -1) {
lineState.append(",");
}
}
agentsSave.add(lineState.toString());
}
return agentsSave;
}
public void loadAgents(ArrayList<String> stringArray) {