예제 #1
0
  public static void run(RobotController myRC) {
    BaseRobot br = null;
    try {
      switch (myRC.getType()) {
        case HQ:
          br = new HQRobot(myRC);
          break;
        case SOLDIER:
          br = new SoldierRobot(myRC);
          break;
        case ARTILLERY:
          br = new Artillery(myRC);
          break;
        default:
          br = new PassiveEncampment(myRC);
      }

      while (true) {
        br.curRound = Clock.getRoundNum();
        br.run();

        br.rc.yield();
      }

    } catch (Exception e) {
      // DEBUG
      System.out.println("Shit happened!");
      e.printStackTrace();
      br.rc.addMatchObservation(e.toString());
    }
  }
예제 #2
0
 protected void postrun() throws GameActionException {
   if (heiarchy == 0 && rc.getHealth() < 20 && rc.getHealth() < prevHealth) {
     rc.broadcastMessageSignal(0xdead, 0xbeef, 100 * 100);
   }
   prevHealth = rc.getHealth();
   super.postrun();
 }
예제 #3
0
  public static void run(RobotController rc) {
    BaseRobot robot = null;

    int rseed = rc.getRobot().getID();
    Util.randInit(rseed, rseed * Clock.getRoundNum());

    try {
      switch (rc.getType()) {
        case HQ:
          robot = new HQRobot(rc);
          break;
        case SOLDIER:
          robot = new SoldierRobot(rc);
          break;
        case ARTILLERY:
          robot = new ArtilleryRobot(rc);
          break;
        case GENERATOR:
          robot = new GeneratorRobot(rc);
          break;
        case MEDBAY:
          robot = new MedbayRobot(rc);
          break;
        case SHIELDS:
          robot = new ShieldsRobot(rc);
          break;
        case SUPPLIER:
          robot = new SupplierRobot(rc);
          break;
        default:
          break;
      }
      robot.loop();
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
예제 #4
0
  @Override
  public void prerun() throws GameActionException {

    if (rc.getRoundNum() % 5 == 0) {
      RobotInfo[] robotsNearMe = rc.senseNearbyRobots();
      for (RobotInfo ri : robotsNearMe) {
        if (ri.team == Team.NEUTRAL && !neutralBotLocations.contains(ri.location)) {
          neutralBotLocations.add(ri.location);
        }
      }
    }
    getSignals();

    if (!suppressSignals && heiarchy == -1 && (!sentGoal || rc.getRoundNum() - lastSentGoal > 10)) {
      MapLocation goal;
      MessageSignal goalDirection = new MessageSignal(rc);
      if (foundZombieDen) {
        goal = knownZombieDenLocations.get(knownZombieDenLocations.size() - 1);
        goalDirection.setCommand(goal, MessageSignal.CommandType.ATTACK);
      } else if (foundEnemyArchon) {
        goal = enemyArchon;
        goalDirection.setCommand(goal, MessageSignal.CommandType.ATTACK);
      } else {
        goal = rc.getLocation();
        goalDirection.setCommand(goal, MessageSignal.CommandType.MOVE);
      }

      goalDirection.send(GameConstants.MAP_MAX_HEIGHT * GameConstants.MAP_MAX_HEIGHT);
      sentGoal = true;
      lastSentGoal = rc.getRoundNum();
      rc.setIndicatorString(2, goal + "");
    } else {
      rc.setIndicatorString(2, "");
      super.prerun();
    }
  }