static void runAfter(RobotController rc) throws GameActionException {
   if (canMessageSignal) {
     if (mapBoundUpdate && Common.lowStrategy == LowStrategy.EXPLORE) {
       final int minRadius = 2 * sightRadius;
       int bounds = Signals.getBounds(rc).toInt();
       MapLocation target = furthestArchonStart(rc);
       int radius = MAP_UPDATE_MESSAGE_FACTOR * rc.getLocation().distanceSquaredTo(target);
       if (radius < minRadius || rc.getType() == RobotType.ARCHON) radius = minRadius;
       rc.broadcastMessageSignal(bounds, Signals.BUFFER, radius);
       ++sent;
       sendBoundariesLow = false;
       sendBoundariesHigh = false;
       mapBoundUpdate = false;
     }
     if (sendBoundariesLow) Signals.addBoundsLow(rc);
     if (sendBoundariesHigh) Signals.addBoundsHigh(rc);
   }
   sent += Signals.sendQueue(rc, sendRadius);
   // rc.setIndicatorString(0, String.format("sent %d received %d bounds %d %d %d %d", sent, read,
   // xMin, yMin, xMax, yMax));
 }
 static boolean kamikaze(RobotController rc, Direction dir) throws GameActionException {
   // bc bug: dieing on last turn of infection does not spawn zombie
   if (Common.rc.getInfectedTurns() > 1) {
     // System.out.println("Zombie Kamikaze!");
     Signals.addSelfZombieKamikaze(Common.rc, dir);
     Common.rc.disintegrate();
     return true;
   } else {
     // System.out.println("Zombie Kamikaze FAILED");
     return false;
   }
 }
 void read() throws GameActionException {
   switch (type) {
     case MAP_LOW:
       if (Common.xMin == Common.MAP_NONE && x != Signals.SIG_NONE) {
         int newx = x + Common.hometown.x / Common.MAP_MOD * Common.MAP_MOD;
         if (newx > Common.hometown.x) newx -= Common.MAP_MOD;
         Common.xMin = newx;
         Common.xMax = Common.twiceCenterX - Common.xMin;
         if (Common.canMessageSignal) Common.sendBoundariesLow = true;
       }
       if (Common.yMin == Common.MAP_NONE && y != Signals.SIG_NONE) {
         int newy = y + Common.hometown.y / Common.MAP_MOD * Common.MAP_MOD;
         if (newy > Common.hometown.y) newy -= Common.MAP_MOD;
         Common.yMin = newy;
         if (Common.canMessageSignal) Common.sendBoundariesLow = true;
       }
       break;
     case MAP_HIGH:
       if (Common.xMax == Common.MAP_NONE && x != Signals.SIG_NONE) {
         int newx = x + Common.hometown.x / Common.MAP_MOD * Common.MAP_MOD;
         if (newx < Common.hometown.x) newx += Common.MAP_MOD;
         Common.xMax = newx;
         Common.xMin = Common.twiceCenterX - Common.xMax;
         if (Common.canMessageSignal) Common.sendBoundariesHigh = true;
       }
       if (Common.yMax == Common.MAP_NONE && y != Signals.SIG_NONE) {
         int newy = y + Common.hometown.y / Common.MAP_MOD * Common.MAP_MOD;
         if (newy < Common.hometown.y) newy += Common.MAP_MOD;
         Common.yMax = newy;
         if (Common.canMessageSignal) Common.sendBoundariesHigh = true;
       }
       break;
     case ENEMY:
       Signals.enemies[Signals.enemiesSize++] = Signals.expandPoint(x, y);
       break;
     case TARGET:
       Signals.targets[Signals.targetsSize++] = Signals.expandPoint(x, y);
       break;
   }
 }
  /**
   * Code to run every turn.
   *
   * @param rc
   */
  static void runBefore(RobotController rc) throws GameActionException {
    // -2 for build signals
    Signals.maxMessages = GameConstants.MESSAGE_SIGNALS_PER_TURN - 2;
    read = Signals.readSignals(rc);
    sent = 0;
    int turn = rc.getRoundNum();

    switch (turn - enrollment) {
      case 0:
        if (targetType != null && Signals.targetsSize > 0) {
          models.addFirst(new Target(targetType, Signals.targets[0]));
        }
        break;
      case 1:
        for (int i = 0; i < sqrt.length; ++i) sqrt[i] = Math.sqrt(i);
        break;
      case 2:
        // Sense rubble a little after construction
        // TODO: change to 3(?) to avoid overlapping with action
        senseRubble(rc);
        break;
      default:
        break;
    }

    if (canMessageSignal) {
      sendRadius = 2 * sightRadius;
      sendBoundariesLow = false;
      sendBoundariesHigh = false;
      senseParts(rc);
    }

    updateMap(rc);
    if (turn > 5) {
      robotInfos = rc.senseNearbyRobots();
      for (RobotInfo info : robotInfos) {
        addInfo(info);
      }
    }
  }
 SignalLocation(LocationType type, MapLocation loc) {
   this.type = type;
   this.x = Signals.reduceCoordinate(loc.x);
   this.y = Signals.reduceCoordinate(loc.y);
 }