コード例 #1
0
 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.");
   }
 }
コード例 #2
0
ファイル: Common.java プロジェクト: bshimanuki/battlecode2016
 /**
  * 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;
 }