Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 61 additions & 1 deletion RobotPlayer.java
Original file line number Diff line number Diff line change
Expand Up @@ -455,6 +455,10 @@ public void run(){
}
//If it can, always tries to build Scouts.
if(rc.isCoreReady()){
MapLocation neutral = RESOURCE_FUNCTIONS.findAdjacentNeutralRobot();
if(neutral != null){
rc.activate(neutral);
}
if(rc.getRoundNum() % 100 == 0){
FancyMessage.sendMessage(1, 1, 1, 3);
}
Expand All @@ -479,7 +483,7 @@ public void run(){
FancyMessage.sendMessage(3, 0, 0, 6400);
}
}
RESOURCE_FUNCTIONS.escapeEnemy();
movement();
}
Clock.yield();
}catch(Exception e){
Expand All @@ -499,6 +503,29 @@ public Triple<Integer, Integer, Integer> getScoutHerdingType(){
int yPosition = (enemyArchonLocation.y + 16000);
return new Triple<Integer, Integer, Integer>(1,xPosition,yPosition);
}

public void movement(){
try{
if(rc.senseHostileRobots(rc.getLocation(), RobotType.ARCHON.sensorRadiusSquared) != null){
RESOURCE_FUNCTIONS.escapeEnemy();
}
if(rc.senseNearbyRobots(RobotType.ARCHON.sensorRadiusSquared, Team.NEUTRAL) != null){
RobotInfo neutral = RESOURCE_FUNCTIONS.seekNeutralRobots();
if(neutral != null){
RESOURCE_FUNCTIONS.BUG(neutral.location);
}
}
if(rc.sensePartLocations(RobotType.ARCHON.sensorRadiusSquared) != null){
MapLocation part = RESOURCE_FUNCTIONS.seekNearestPart();
if(part != null){
RESOURCE_FUNCTIONS.BUG(part);
}
}
}
catch(Exception e){
e.printStackTrace();
}
}
}

/**
Expand Down Expand Up @@ -1257,6 +1284,39 @@ public static Direction nearestRubble(){
}
return null;
}
public static RobotInfo seekNeutralRobots(){
RobotInfo[] neutrals = rc.senseNearbyRobots(RobotType.ARCHON.sensorRadiusSquared, Team.NEUTRAL);
RobotInfo closest = null;
int smallestDistance = 100;
for(RobotInfo neutral: neutrals){
if(closest == null || rc.getLocation().distanceSquaredTo(neutral.location) < smallestDistance){
closest = neutral;
smallestDistance = rc.getLocation().distanceSquaredTo(neutral.location);
}
}
return closest;
}
public static MapLocation findAdjacentNeutralRobot(){
RobotInfo[] neutrals = rc.senseNearbyRobots(RobotType.ARCHON.sensorRadiusSquared, Team.NEUTRAL);
for(RobotInfo neutral: neutrals){
if(neutral != null && rc.getLocation().isAdjacentTo(neutral.location)){
return neutral.location;
}
}
return null;
}
public static MapLocation seekNearestPart(){
MapLocation[] parts = rc.sensePartLocations(RobotType.ARCHON.sensorRadiusSquared);
MapLocation closest = null;
int smallestDistance = 100;
for(MapLocation part: parts){
if(closest == null || rc.getLocation().distanceSquaredTo(part) < smallestDistance){
closest = part;
smallestDistance = rc.getLocation().distanceSquaredTo(part);
}
}
return closest;
}

}

Expand Down