private void buildOrDefendPastr() throws GameActionException { MapLocation desiredPastrLoc = MessageBoard.BEST_PASTR_LOC.readMapLocation(); if (desiredPastrLoc != null) { if (here.equals(desiredPastrLoc)) { // We get to build the pastr! if (rc.isActive()) { rc.construct(RobotType.PASTR); return; } } else { // Go to the pastr location and fight if necessary int distSq = here.distanceSquaredTo(desiredPastrLoc); if (distSq <= 8 && visibleEnemies.length > 0) { if (rc.isActive()) fight(); } else { Nav.Sneak navSneak = distSq <= 30 && visibleEnemies.length == 0 && rc.sensePastrLocations(us).length > 0 ? Nav.Sneak.YES : Nav.Sneak.NO; Nav.goTo(desiredPastrLoc, navSneak, navEngage); // If we didn't move, consider fighting if (rc.isActive() && visibleEnemies.length > 0) fight(); } } } }
private boolean tryBuildNoiseTowerFast() throws GameActionException { if (!rc.isActive()) return false; MapLocation pastrLoc = MessageBoard.BEST_PASTR_LOC.readMapLocation(); if (pastrLoc == null) return false; if (!here.isAdjacentTo(pastrLoc)) return false; constructNoiseTower(pastrLoc); return true; }
private void doFirstTurn() throws GameActionException { MessageBoard.setDefaultChannelValues(); spawnSoldier(); computePastrScores(); computeBestPastrLocation(); MessageBoard.BEST_PASTR_LOC.writeMapLocation(computedBestPastrLocation); Strategy.active = pickStrategyByAnalyzingMap(); MessageBoard.STRATEGY.writeStrategy(Strategy.active); // Debug.indicate("map", 2, "going with " + Strategy.active.toString()); }