Beispiel #1
0
  private void moveTowardDen() throws GameActionException {
    if (!rc.isCoreReady()) {
      return;
    }

    if (zombieDen == null && zombieDens.isEmpty()) {
      return;
    }

    if (zombieDen == null && !zombieDens.isEmpty()) {
      zombieDen = zombieDens.removeClosestTo(currentLocation);
      setIndicatorString(1, "removed den " + zombieDen);
    }

    if (rc.canSenseLocation(zombieDen) && rc.senseRobotAtLocation(zombieDen) == null) {
      zombieDen = null;
      return;
    }

    if (currentLocation.distanceSquaredTo(zombieDen) > 8) {
      setIndicatorString(0, "going to den " + zombieDen);
      tryMoveToward(zombieDen);
    }
  }
Beispiel #2
0
 @Override
 protected void doTurn() throws GameActionException {
   readBroadcasts();
   senseRobots();
   shootZombies();
   shootEnemies();
   microAwayFromZombies();
   moveTowardZombieNotGettingCloser();
   moveTowardZombie();
   moveTowardDen();
   moveTowardEnemy();
   moveAwayFromArchon();
   updateZombieMemory();
   clearRubble();
   spread();
   setIndicatorString(2, "set size " + zombieDens.getSize());
 }
Beispiel #3
0
  private void readBroadcasts() {
    roundSignals = rc.emptySignalQueue();
    zombieToAttack = getZombieToAttack();
    RobotData broadcastDen = getZombieDen();
    if (broadcastDen != null
        && !denDestroyed[broadcastDen.id]
        && broadcastDen.location != zombieDen) {
      setIndicatorString(2, "learned den exists " + broadcastDen);
      zombieDens.add(broadcastDen);
    }

    MapLocation newEnemyLocation = getEnemyLocation();
    if (newEnemyLocation != null) {
      enemyLocation = newEnemyLocation;
    }

    updateDestroyedDens();
  }
Beispiel #4
0
  private void updateDestroyedDens() {
    int maxDenMessages = 10;
    MessageParser[] parsers =
        getParsersForMessagesOfType(roundSignals, MessageType.DESTROYED_DENS, maxDenMessages);
    setIndicatorString(2, "learned dens destroyed");
    for (int i = 0; i < maxDenMessages; i++) {
      if (parsers[i] == null) {
        break;
      }

      DestroyedDenData denData = parsers[i].getDestroyedDens();
      for (int j = 0; j < denData.numberOfDens; j++) {
        int currentId = denData.denId[j];
        if (!denDestroyed[currentId]) {
          denDestroyed[currentId] = true;
          zombieDens.remove(currentId);
          setIndicatorString(2, " " + currentId);
        }
      }
    }
  }