@Override
  public void playOneTurn() throws GameActionException {
    super.playOneTurn();

    // if (rc.isActive()) {

    // nearbyFriendlyRobots = rc.senseNearbyGameObjects(Robot.class, 40, myTeam);

    // numNearbyFriendlySoldiers = countSoldiers(nearbyFriendlyRobots, rc);

    maybeAskForBackup();
    // }

    rc.yield();
  }
Exemplo n.º 2
0
 @Override // this is sort of optional, but basically it says to use this instead of what's
 // inherited
 public void setScore(int myMove, int oppMove, int myScore, int oppScore, String oppID) {
   oppLastMove = oppMove;
   super.setScore(myMove, oppMove, myScore, oppScore, oppID);
 }
  @Override
  public void playOneTurn() throws GameActionException {
    super.playOneTurn();

    // while (true) {
    //	gameMap.nextDirectionTo(myHqLocation, enemyHqLocation);
    // }

    // evaluate strategy

    // things we can do:
    //
    // 1. order other units around
    // 2. attack nearby enemies
    // 3. spawn a new robot

    // 1. order other units around
    // 1a. tell someone to become a noisetower
    // 1b. tell someone to become a pastr
    // 1c. tell someone to go to a position on the map

    // 2. attack nearby enemies
    // sense nearby enemies (to HQ)
    // attack them

    // 3. spawn a new robot
    // if not attacking

    allFriendlyRobots = rc.senseNearbyGameObjects(Robot.class, HUGE_RADIUS, myTeam);
    nearbyFriendlyRobots =
        rc.senseNearbyGameObjects(Robot.class, myRobotType.sensorRadiusSquared * 2, myTeam);

    numNearbyFriendlySoldiers = countSoldiers(nearbyFriendlyRobots, rc);

    boolean didAttack = false;

    if (rc.isActive()) {
      didAttack = attackNearbyEnemies();
    }

    boolean didSpawn = false;

    if (!didAttack && rc.isActive()) {
      didSpawn = tryToSpawn();
    }

    // if (friendlyRobots.length > 16) {

    if (numNearbyFriendlySoldiers > 2) {

      maybeAskForNoiseTower();

      maybeAskForPastr();
    }

    // if (Clock.getRoundNum() > 500) {
    // maybeCreateExploringWaypoint();
    // }

    rc.yield();
  }