This commit is contained in:
Timéo 2024-05-29 16:08:42 +02:00
commit cd5f987b97
2 changed files with 13 additions and 3 deletions

View File

@ -409,8 +409,18 @@ public class Simulator extends Thread {
public ArrayList<String> getAgentsSave() { public ArrayList<String> getAgentsSave() {
//TODO : Same idea as the other save method, but for agents ArrayList<String> agentsSave = new ArrayList<>();
return null; 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) { public void loadAgents(ArrayList<String> stringArray) {

View File

@ -13,7 +13,7 @@ public class Wolf extends Agent {
//first we call the constructor of the superClass(Animal) //first we call the constructor of the superClass(Animal)
//with the values we want. //with the values we want.
// here we decide that a Sheep is initially white using this constructor // here we decide that a Sheep is initially white using this constructor
super(x,y,Color.orange); super(x,y,Color.red);
// we give our sheep a hunger value of zero at birth // we give our sheep a hunger value of zero at birth
hunger = 0; hunger = 0;
//we initialize the random number generator we will use to move randomly //we initialize the random number generator we will use to move randomly