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
66 changes: 48 additions & 18 deletions RobotPlayer.java
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,12 @@ else if(selftype == RobotType.SOLDIER) {
*/
private class Soldier {

public MapLocation enemyArchonLocation;
public boolean goOffense;
public int moveCount;

public Soldier() {
moveCount = 0;
}

public void run() {
Expand All @@ -81,24 +86,33 @@ public void run() {
// receive a message containing enemy archon ID
if (s.getTeam() == ourTeam) {
FancyMessage f = FancyMessage.getFromRecievedSignal(s);

System.out.println(f.type);
if(f.type == 2){
System.out.println("66");
int xPos = f.ints.first;
int yPos = f.ints.second;
enemyArchonLocation = new MapLocation(xPos, yPos);
goOffense = true;
}
/*if (moveCount < 1 && rc.senseRobot(s.getID()).type == RobotType.ARCHON) {
MapLocation archonLocation = f.senderLocation;
Direction archonDirection = rc.getLocation().directionTo(archonLocation);
Direction oppositeDirection = archonDirection.opposite();
if (rc.isCoreReady() && rc.canMove(oppositeDirection)) {
moveCount += 1;
rc.move(oppositeDirection);
}
}*/
}
// intercept a message containing enemy archon location
if (s.getTeam() == opponentTeam && enemyArchonIDs.contains(s.getID())) {
FancyMessage f = FancyMessage.getFromRecievedSignal(s);

}
if (s.getTeam() == ourTeam && rc.senseRobot(s.getID()).type == RobotType.ARCHON) {
/*if (s.getTeam() == opponentTeam && enemyArchonIDs.contains(s.getID())) {
FancyMessage f = FancyMessage.getFromRecievedSignal(s);
MapLocation archonLocation = f.senderLocation;
Direction archonDirection = rc.getLocation().directionTo(archonLocation);
Direction oppositeDirection = archonDirection.opposite();
if (rc.isCoreReady() && rc.canMove(oppositeDirection)) {
rc.move(oppositeDirection);
}
}
}*/
}
}
if(rc.isCoreReady() && goOffense){
RESOURCE_FUNCTIONS.BUG(enemyArchonLocation);
}
if(rc.isWeaponReady()){
RobotInfo[] robots = rc.senseNearbyRobots();
for(RobotInfo robot: robots) {
Expand All @@ -109,9 +123,9 @@ public void run() {
}
}
// If there are enough scouts around, move out towards enemy Archon
if (mostRecentEnemyArchonLocations.size() > 0 && RESOURCE_FUNCTIONS.numberOfRobotsInRadiusAndThoseRobots(RobotType.SOLDIER, RobotType.SOLDIER.sensorRadiusSquared, rc.getTeam()).first > 5) {
/* (mostRecentEnemyArchonLocations.size() > 0 && RESOURCE_FUNCTIONS.numberOfRobotsInRadiusAndThoseRobots(RobotType.SOLDIER, RobotType.SOLDIER.sensorRadiusSquared, rc.getTeam()).first > 5) {
RESOURCE_FUNCTIONS.BUG(RESOURCE_FUNCTIONS.mostRecentEnemyArchonLocation());
}
}*/

} catch (Exception e) {
e.printStackTrace();
Expand Down Expand Up @@ -153,12 +167,17 @@ public void run() {
if(rc.isWeaponReady()){
RobotInfo[] robots = rc.senseNearbyRobots();
for(RobotInfo robot: robots) {
if((robot.team == Team.ZOMBIE || robot.team == opponentTeam) && rc.canAttackLocation(robot.location)) {
if((robot.team == Team.ZOMBIE) && rc.canAttackLocation(robot.location)) {
rc.attackLocation(robot.location);
break;
}
}
for(RobotInfo robot: robots) {
if((robot.team == opponentTeam) && rc.canAttackLocation(robot.location)) {
rc.attackLocation(robot.location);
break;
}
}
//rc.move(Direction.EAST);
}
Clock.yield();
}catch(Exception e){
Expand Down Expand Up @@ -250,6 +269,13 @@ public Scout(){
public void run(){
while(true){
try{
MapLocation enemyArchonLocation = RESOURCE_FUNCTIONS.scanArchonLocation();
if(enemyArchonLocation != null){
System.out.println("XXXXXXXXXXXXXXX");
int xPos = enemyArchonLocation.x;
int yPos = enemyArchonLocation.y;
FancyMessage.sendMessage(2, xPos, yPos, 1000);
}
//Do nothing until base-line information is gathered: ie, where are the archons. in future, archons may also give message assigning role
if(base == null){
Signal[] signals = rc.emptySignalQueue();
Expand Down Expand Up @@ -510,7 +536,7 @@ public static boolean moveAsFarAwayAsPossibleFrom(MapLocation epicenter) throws
public static RobotType chooseRobotType() {
for(int i: zombieRounds){
int currentRound = rc.getRoundNum();
if(i-currentRound<=15 && i-currentRound>=0){
if(i-currentRound<=60 && i-currentRound>=0){
return RobotType.SCOUT;
}
}
Expand All @@ -520,6 +546,10 @@ public static RobotType chooseRobotType() {
if(numberOfRobotsInRadiusAndThoseRobots(RobotType.GUARD,3,ourTeam).first == 7){
return RobotType.SCOUT;
}
int fate = randall.nextInt(2);
if(fate == 1){
return RobotType.SOLDIER;
}
return RobotType.GUARD;
}

Expand Down