public void graze() {
    int maxLoops = 10;
    while (!stopGrazing() && (maxLoops > 0)) {
      maxLoops--;
      me.sortNeighborsByMassDesc(true);
      for (int i=0; i < me.getNeighborCount(true); i++) {
        LifeI neighbor = me.getNeighbor(true, i);
        if (neighbor.getMass() < me.getMass()) {
          double maxStomachCapacity = me.getMaxStomachMass();
          double netEnergy = me.getNetEnergyFromEating(true, i);
          //System.out.println(me.getShortId()+" mass="+Const.f(me.getMass())+" hisMass="+Const.f(neighbor.getMass())+ 
          //    " net="+Const.f(netEnergy)+" action="+Const.f(me.getAction())+
          //    " stomach "+Const.f(me.getStomachContentMass())+"/"+Const.f(me.getMaxStomachMass()));
          if (netEnergy > 0) {
            me.attack(true, i);
          } 
   
          // If we have some food in our stomach, and the rest of the plants are small we will move on
          if ((me.getStomachContentMass() > (maxStomachCapacity * 0.1)) && 
              (netEnergy < (me.getMass() * 0.01))) {
            if (moveOn()) {
              // We need to clear the neighbors and reload them for the new position
              me.clearNeighbors(true);
              break; // exit the for loop, the while loop will catch us 
            } else {
              // failed to move (not enough energy likely)
              maxLoops = 0;
              break;
            }
          }
          // Short out of the loop
          if (stopGrazing()) {
            maxLoops = 0;
            break;
          }
        }
      }// for
    } // while
  }