problem resolution

This commit is contained in:
titou 2024-05-27 16:49:30 +02:00
parent beb9f1f259
commit 8ab74dfb89
1 changed files with 12 additions and 10 deletions

View File

@ -333,25 +333,27 @@ public class Simulator extends Thread {
System.out.println("empty rule file"); System.out.println("empty rule file");
return; return;
} }
//TODO : remove previous rule (=emptying lists)
fieldSurviveValues.clear();
fieldBirthValues.clear();
String[] surviveElements = lines.get(0).split(";");
for (int x = 0; x < surviveElements.length; x++) { String surviveLine = lines.get(0);
String birthLine = lines.get(1);
String[] surviveElements = surviveLine.split(";");
for(int x=0; x<surviveElements.length;x++) {
String elem = surviveElements[x]; String elem = surviveElements[x];
int value = Integer.parseInt(elem); int value = Integer.parseInt(elem);
fieldSurviveValues.add(value); //TODO : add value to possible survive values
} }
String[] birthElements = birthLine.split(";");
String[] birthElements = lines.get(1).split(";"); for(int x=0; x<birthElements.length;x++) {
for (int x = 0; x < birthElements.length; x++) {
String elem = birthElements[x]; String elem = birthElements[x];
int value = Integer.parseInt(elem); int value = Integer.parseInt(elem);
fieldBirthValues.add(value); //TODO : add value to possible birth values
} }
} }
//DONE
public ArrayList<String> getAgentsSave() { public ArrayList<String> getAgentsSave() {
//TODO : Same idea as the other save method, but for agents //TODO : Same idea as the other save method, but for agents