From 2c63f60c1a5a99777795fd6873a6b2454007554b Mon Sep 17 00:00:00 2001 From: laure Date: Wed, 29 May 2024 15:50:38 +0200 Subject: [PATCH 1/2] wolf in red --- src/backend/Wolf.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/backend/Wolf.java b/src/backend/Wolf.java index a452008..4288bdb 100644 --- a/src/backend/Wolf.java +++ b/src/backend/Wolf.java @@ -13,7 +13,7 @@ public class Wolf extends Agent { //first we call the constructor of the superClass(Animal) //with the values we want. // 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 hunger = 0; //we initialize the random number generator we will use to move randomly From 1c69102be1cf31816deaabc1abd05c42c2b52c16 Mon Sep 17 00:00:00 2001 From: benoi Date: Wed, 29 May 2024 16:06:56 +0200 Subject: [PATCH 2/2] getAgentsSave --- src/backend/Simulator.java | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/backend/Simulator.java b/src/backend/Simulator.java index a9c7743..ae214be 100644 --- a/src/backend/Simulator.java +++ b/src/backend/Simulator.java @@ -413,8 +413,18 @@ public class Simulator extends Thread { public ArrayList getAgentsSave() { - //TODO : Same idea as the other save method, but for agents - return null; + ArrayList 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 stringArray) {