From 127cc64841e369caeeb8117310dbe42cc55648b8 Mon Sep 17 00:00:00 2001 From: laure Date: Wed, 29 May 2024 18:55:07 +0200 Subject: [PATCH] now realy uptodate --- src/backend/Simulator.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/backend/Simulator.java b/src/backend/Simulator.java index 6450bde..4f7a38b 100644 --- a/src/backend/Simulator.java +++ b/src/backend/Simulator.java @@ -198,7 +198,15 @@ public class Simulator extends Thread { * method called when clicking on a cell in the interface */ public void clickCell(int x, int y) { - setCell(x, y, getCell(x, y) == 1 ? 0 : 1); + if (clickActionFlag==0) { // cell + setCell(x, y, getCell(x, y) == 1 ? 0 : 1); + } else if (clickActionFlag==1) { // sheep + Sheep sheep = new Sheep(x,y); + agents.add(sheep); + } else if (clickActionFlag==2) { // wolf + Wolf wolf = new Wolf(x,y); + agents.add(wolf); + } }