private static boolean reactiveRush(RobotController rc) throws GameActionException { // TODO if we are losing in an economy based game int ally = rc.sensePastrLocations(rc.getTeam()).length; int enemy = rc.sensePastrLocations(rc.getTeam().opponent()).length; if (rush) { return true; } else if (enemy > ally) { // System.out.println("REACTIVE RUSH"); return true; } else if (rc.readBroadcast(Util.failedPastr) > 0) { // System.out.println("REACTIVE RUSH 1"); return true; } return false; }
private static void kamikaze(RobotController rc) throws GameActionException { Team enemy = rc.getTeam().opponent(); MapLocation[] enemyPASTRs = rc.sensePastrLocations(enemy); if (enemyPASTRs.length > 0) Move.moveTo(rc, enemyPASTRs[0]); else Move.moveTo(rc, rc.senseEnemyHQLocation()); }
// Put team and enemy team pasture, squad, and role info into channels static void updateSquadLocs(RobotController rc) throws GameActionException { // DEFENDER CHANNELS - 3 to about 8 // format: [N][XXYY] where N is robot count in the squad and XXYY are coordinates // RUSH CHANNEL - 11 MapLocation[] enemyPASTRs = rc.sensePastrLocations(enemy); MapLocation rallyPoint = determineRallyPoint(rc); // TODO surround enemy HQ - rush ENDGAME :) if (rc.readBroadcast(Util.rushSuccess) > 0) { rc.broadcast(11, (rc.readBroadcast(11) / 10000) * 10000 + Util.locToInt(HQ.enemyHQ)); } else if (rush && Clock.getRoundNum() < 1000) { // System.out.println("rush and under 1000"); if (enemyPASTRs.length > 0) { rc.broadcast(11, (rc.readBroadcast(11) / 10000) * 10000 + Util.locToInt(enemyPASTRs[0])); attackedEnemy = true; } else if (attackedEnemy && enemyPASTRs.length == 0) { // shut down headquarters and endgame rc.broadcast( 11, (rc.readBroadcast(11) / 10000) * 10000 + Util.locToInt(rc.senseEnemyHQLocation())); } else rc.broadcast(11, (rc.readBroadcast(11) / 10000) * 10000 + Util.locToInt(rallyPoint)); } for (int i = 0; i < enemyPASTRs.length; i++) { if (enemyPASTRs[i].distanceSquaredTo(rc.senseEnemyHQLocation()) < 36) { // the pastr is untouchable rc.broadcast( i + 12, (rc.readBroadcast(i + 12) / 10000) * 10000 + Util.locToInt(rallyPoint)); } else { rc.broadcast( i + 12, (rc.readBroadcast(i + 12) / 10000) * 10000 + Util.locToInt(enemyPASTRs[i])); } } for (int i = 0; i < desiredPASTRs.length; i++) { rc.broadcast( i + 3, (rc.readBroadcast(i + 3) / 10000) * 10000 + Util.locToInt(desiredPASTRs[i])); // System.out.println("SQUAD TRACKER " + (i+3)); } }