# WARNING: head commit changed in the meantime

Merge branch 'master' of
https://gitarero.ecam.fr/laure.bel/OOP_F3_Project.git
This commit is contained in:
benoi 2024-05-30 11:12:06 +02:00
parent 65d2baabfd
commit 7a79420cd1
2 changed files with 10 additions and 2 deletions

View File

@ -327,7 +327,15 @@ public class Simulator extends Thread {
} }
return inArea; return inArea;
} }
public String typeAnimals(int x , int y,ArrayList<Agent> neighbor) {
//ArrayList<Agent> neighbor =getNeighboringAnimals(x,y,1);
Agent agent = neighbor.get(0);
if (agent instanceof Wolf) {
return "Wolf";
} else {
return "Sheep";
}
}
/** /**
* set value of cell * set value of cell
* @param x coord of cell * @param x coord of cell

View File

@ -26,7 +26,7 @@ public class Wolf extends Agent {
* as you wish * as you wish
*/ */
public boolean liveTurn(ArrayList<Agent> neighbors, Simulator world) { public boolean liveTurn(ArrayList<Agent> neighbors, Simulator world) {
if(world.getCell(x, y)==1) { if(world.getCell(x, y)== Sheep sheep) {
world.setCell(x, y, 0); world.setCell(x, y, 0);
} else { } else {
hunger++; hunger++;