clickCell

This commit is contained in:
titou 2024-05-26 13:04:49 +02:00
parent 5130096de8
commit d6be7bff9c
1 changed files with 12 additions and 0 deletions

View File

@ -147,6 +147,18 @@ public class Simulator extends Thread {
*/ */
public void clickCell(int x, int y) { public void clickCell(int x, int y) {
//TODO : complete method //TODO : complete method
if (clickActionFlag) {
for (Agent agent : agents) {
if(agent.getX() == x && agent.getY() == y) {
agents.remove(agent);
return;
}
}
agents.add(new Sheep(x,y));
}
else {
field[y][x] = (field[y][x] == 0) ? 1 : 0;
}
} }
/** /**