public static void run(RobotController _rc) throws Exception {
   switch (_rc.getType()) {
     case ARCHON:
       Archon.run(_rc);
       break;
     case GUARD:
       Guard.run(_rc);
       break;
     case SCOUT:
       Scout.run(_rc);
       break;
     case SOLDIER:
       Soldier.run(_rc);
       break;
     case TTM:
     case TURRET:
       Turret.run(_rc);
       break;
     case VIPER:
       Viper.run(_rc);
       break;
     default:
       // this shouldn't happen
       throw new Exception("I am a bad robot.");
   }
 }
Esempio n. 2
0
 /**
  * Attack a robot from infos. Assumed to have delay.
  *
  * @param rc
  * @param infos
  * @return true if attacked
  */
 static boolean attack(RobotController rc, RobotInfo[] infos) throws GameActionException {
   if (Common.robotType == RobotType.VIPER) return Viper.attack(rc, infos);
   // TODO: better selection
   for (RobotInfo info : infos) {
     if (rc.canAttackLocation(info.location)) {
       rc.attackLocation(info.location);
       return true;
     }
   }
   return false;
 }