while(!getNeighbours(2, 2, Leaf.class).isEmpty())
while(!getNeighbours(2, 2, Leaf.class).isEmpty())
while(!getNeighbours((1,true), (1,false), Leaf.class).isEmpty()) {
//turn towards nearest leaf and move in that direction
}while(!getNeighbours(2, false, Leaf.class).isEmpty())
/**
* The Wombat behavior has to be implemented in this method.
* The Wombat should always take one step in the direction of the closest Leaf.
*/
public void wombatBehavior() {
if(foundLeaf()) {
eatLeaf();
}
else if(!foundLeaf()) {
move(1);
}
while(!getNeighbours(2, true, Leaf.class).isEmpty()) {
//turn towards nearest leaf and move in that direction
getOneIntersectingObject(Leaf.class);
if ((getNeighbours(2, true, Leaf.class).isEmpty()) == true);
move(1);
}
}