last comments
This commit is contained in:
parent
a8a6c556b7
commit
2755e9695b
|
|
@ -26,8 +26,7 @@ public class Wolf extends Agent {
|
|||
* as you wish
|
||||
*/
|
||||
public boolean liveTurn(ArrayList<Agent> neighbors, Simulator world) {
|
||||
//ArrayList<Agent> nearby=world.getNeighboringAnimals(x,y,1); //look if the cell has an agent
|
||||
if (!neighbors.isEmpty()) {
|
||||
if (!neighbors.isEmpty()) { //checks if the adjacent cells are empty ; if it's a sheep, it makes another sheep appear and delete it, which makes both disappear
|
||||
if(world.typeAnimals(x,y, neighbors)== "Sheep") {
|
||||
Sheep sheep = new Sheep(x,y) ;
|
||||
world.getAnimals().remove(sheep);
|
||||
|
|
|
|||
Loading…
Reference in New Issue