Esempio n. 1
0
 protected ZSquare bestSquareToAvoidConflict(ZSquare target) {
   if (isAroundNest()) return null; // Don't avoid conflict when nearby own nest
   double dist = 0;
   ZSquare best = null;
   for (ZSquare s : neighbors) {
     if (s.isPassable() && s.getNumberOfAnts() == 0) {
       double d = Constants.normalDistance(target.x - s.x, target.y - s.y);
       if (d > dist) best = s;
     }
   }
   if (best != null) assert best.isPassable();
   return best;
 }
Esempio n. 2
0
 protected ZSquare squareTo(Integer key) {
   assert key != null;
   ZSquare s = squareTo(Constants.decodedX(key), Constants.decodedY(key));
   assert s != null;
   return s;
 }