Ejemplo n.º 1
0
  public Boolean canMobilizeForClockNumber(int clockNumber, int roundLimit)
      throws GameActionException {

    int totalLaunchers = this.broadcaster.robotCountFor(Launcher.type());
    if (this.broadcaster.hasSeenLaunchers()) {

      if (totalLaunchers > 6) return true;

    } else {

      if (clockNumber > roundLimit - 300) {

        return true;

      } else {

        if (totalLaunchers > 6) return true;
      }
    }
    return false;
  }
Ejemplo n.º 2
0
  // @param turns    the amount of turns that the budget was saved up for
  // @param progress the progress that we are in the build order
  public void updateBudgetingForBuildOrderProgress(int turns, int oreMined, int progress)
      throws GameActionException {

    int remainingOre = oreMined;

    // check if we need to take some for the supply depots
    if (progress >= this.civicRatios.length - 1) {

      if (this.broadcaster.budgetForType(RobotType.SUPPLYDEPOT) < 250) {

        this.broadcaster.incrementBudget(RobotType.SUPPLYDEPOT, (int) (remainingOre * 0.1));
        remainingOre *= 0.9;
      }
    }

    // firstly check the beavers
    final int beavers = this.broadcaster.robotCountFor(Beaver.type());
    int beaverOreAllocation = 0;
    if (beavers == 0) {

      beaverOreAllocation = 100;
    }

    // miners
    final int minerFactories = this.broadcaster.robotCountFor(MinerFactory.type());
    int minerOreAllocation = 0;
    if (minerFactories > 0 && this.broadcaster.robotCountFor(Miner.type()) < 30) {

      minerOreAllocation = (60 / (20 / turns));
      if (this.broadcaster.budgetForType(Miner.type()) >= minerFactories * 60)
        minerOreAllocation = 0;
    }

    // launchers
    final int aerospaceLabs = this.broadcaster.robotCountFor(AerospaceLab.type());
    int launcherOreAllocation = aerospaceLabs * (400 / (100 / turns));
    if (this.broadcaster.budgetForType(Launcher.type()) >= aerospaceLabs * 400)
      launcherOreAllocation = 0;

    // drones
    int droneOreAllocation = 0;
    if (Clock.getRoundNum() > 600 && this.broadcaster.robotCountFor(Drone.type()) == 0) {

      droneOreAllocation = 8;
    }

    int total =
        beaverOreAllocation + minerOreAllocation + launcherOreAllocation + droneOreAllocation;
    double multiplier = (total > remainingOre) ? remainingOre / (float) total : 1.0;

    this.broadcaster.incrementBudget(Beaver.type(), (int) (beaverOreAllocation * multiplier));
    this.broadcaster.incrementBudget(Miner.type(), (int) (minerOreAllocation * multiplier));
    this.broadcaster.incrementBudget(Launcher.type(), (int) (launcherOreAllocation * multiplier));
    this.broadcaster.incrementBudget(Drone.type(), (int) (droneOreAllocation * multiplier));

    remainingOre -= total * multiplier;
    if (remainingOre > 40 && oreMined < 500 /* first turn */) {

      beaverOreAllocation = 10;
      this.broadcaster.incrementBudget(Beaver.type(), beaverOreAllocation);
      remainingOre -= beaverOreAllocation;
    }
    this.broadcaster.incrementCivicBudget(remainingOre);
  }