예제 #1
0
 @Override
 public boolean isInside(Dimension dim, Position p) {
   // If the distance between the position and the middle of the circle is
   // smaller than the radius, then it's inside the shape.
   double distance = p.getDistance(new Position(dim.getWidth() / 2, dim.getHeight() / 2));
   return distance < dim.getWidth() / 2;
 }
 @Override
 public boolean isLookingTasty(IAgent agent) {
   return position.getDistance(agent.getPosition()) <= agent.getVisionRange();
 }