/** onHitRobot: Set him as our new target */
 @Override
 public void onHitRobot_(solomon s, HitRobotEvent e) {
   // Only print if he's not already our target.
   if (trackName != null && !trackName.equals(e.getName())) {
     // out.println("Tracking " + e.getName() + " due to collision");
   }
   // Set the target
   trackName = e.getName();
   // Back up a bit.
   // Note:  We won't get scan events while we're doing this!
   // An AdvancedRobot might use setBack(); execute();
   gunTurnAmt = normalRelativeAngle(e.getBearing() + (s.getHeading() - s.getRadarHeading()));
   s.turnGunRight(gunTurnAmt);
   s.fire(3);
   s.back(50);
 }
  /** onScannedRobot: Here's the good stuff */
  @Override
  public void onScannedRobot_(solomon s, ScannedRobotEvent e) {

    // If we have a target, and this isn't it, return immediately
    // so we can get more ScannedRobotEvents.
    if (trackName != null && !e.getName().equals(trackName)) {
      return;
    }

    // If we don't have a target, well, now we do!
    if (trackName == null) {
      trackName = e.getName();
      // out.println("Tracking " + trackName);
    }
    // This is our target.  Reset count (see the run method)
    count = 0;
    // If our target is too far away, turn and move torward it.
    if (e.getDistance() > 150) {
      gunTurnAmt = normalRelativeAngle(e.getBearing() + (s.getHeading() - s.getRadarHeading()));

      s.turnGunRight(gunTurnAmt); // Try changing these to setTurnGunRight,
      s.turnRight(e.getBearing()); // and see how much Tracker improves...
      // (you'll have to make Tracker an AdvancedRobot)
      s.ahead(e.getDistance() - 135);
      return;
    }

    // Our target is close.
    gunTurnAmt = normalRelativeAngle(e.getBearing() + (s.getHeading() - s.getRadarHeading()));
    s.turnGunRight(gunTurnAmt);
    s.fire(3);

    // Our target is too close!  Back up.
    if (e.getDistance() < 100) {
      if (e.getBearing() > -90 && e.getBearing() <= 90) {
        s.back(30);
      } else {
        s.ahead(40);
      }
    }
    s.scan();
  }