@Override
 public void update(double time) {
   for (Prey p : getPrey()) {
     for (Robot r : getRobots()) {
       if (r.getPosition().distanceTo(p.getPosition()) < consumingDistance) {
         placePrey(p);
         preysCaught++;
       }
     }
   }
 }
  @Override
  public void update(double time) {
    if (redeployPrey && !anyActivePrey()) {
      // There are no prey active, so we have to redeploy
      redeployPrey();
    }

    nest.shape.getClosePrey().update(time, teleported);
    CloseObjectIterator i = nest.shape.getClosePrey().iterator();

    while (i.hasNext()) {
      PhysicalObjectDistance preyDistance = i.next();
      Prey nextPrey = (Prey) (preyDistance.getObject());
      double distance = nextPrey.getPosition().length();
      if (nextPrey.isEnabled() && distance < nestLimit) {
        if (distance == 0) {
          System.out.println("ERRO--- zero");
        }

        if (redeployPrey && currentRedeployCounter <= 0) nextPrey.setEnabled(false);
        else if (redeployPrey) {
          nextPrey.teleportTo(newPreyPosition());
          currentRedeployCounter--;
        } else nextPrey.teleportTo(newPreyPosition());

        numberOfFoodSuccessfullyForaged++;
      }
      i.updateCurrentDistance(distance);
    }

    for (Robot robot : robots) {
      PreyCarriedSensor sensor = (PreyCarriedSensor) robot.getSensorByType(PreyCarriedSensor.class);
      if (sensor.preyCarried() && robot.isInvolvedInCollison()) {
        PreyPickerActuator actuator =
            (PreyPickerActuator) robot.getActuatorByType(PreyPickerActuator.class);
        Prey preyToDrop = actuator.dropPrey();
        preyToDrop.teleportTo(newPreyPosition());
      }
    }
  }
 private void placePrey(Prey prey) {
   prey.teleportTo(newRandomPosition());
 }