/////////////////////////////////////////////////////////// // moveClear() // private static void moveClear() throws GameActionException { while (true) { MapLocation center = closestArchonLoc(); if (rc.getLocation().distanceSquaredTo(center) >= guardRad) break; else { if (!moveAway(center)) break; } } rc.unpack(); Clock.yield(); }
///////////////////////////////////////////////////////////// // moveAway() // private static boolean moveAway(MapLocation center) throws GameActionException { while (!rc.isCoreReady()) { Clock.yield(); } Direction dir = center.directionTo(rc.getLocation()); int c = 0; while (!rc.canMove(dir)) { dir = dir.rotateRight(); c++; if (c >= 4) return false; } rc.move(dir); return true; }