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
78 changes: 71 additions & 7 deletions RobotPlayer.java
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,14 @@ else if(selftype == RobotType.VIPER){
Viper s = new RobotPlayer().new Viper();
s.run();
}
else if(selftype == RobotType.TURRET){
Turret s = new RobotPlayer().new Turret();
s.run();
}
else if(selftype == RobotType.TTM){
TTM s = new RobotPlayer().new TTM();
s.run();
}
}

/**
Expand Down Expand Up @@ -113,7 +121,7 @@ public void run() {
}

}
/**
/**
*
* Class Turret
*
Expand All @@ -122,29 +130,85 @@ public void run() {
*/
private class Turret{

MapLocation enemyLocation;
//MapLocation enemyLocation;
public MapLocation enemyArchonLocation;


public Turret(){

}

public void run(){
while(true){
try{Signal[] signals = rc.emptySignalQueue();
if (signals.length > 0) {
for (Signal s : signals) {
// receive a message containing enemy archon ID
if (s.getTeam() == ourTeam) {
FancyMessage f = FancyMessage.getFromRecievedSignal(s);
if(f.type == 2){
int xPos = f.ints.first;
int yPos = f.ints.second;
enemyArchonLocation = new MapLocation(xPos, yPos);
}
}
}
}
if(enemyArchonLocation.distanceSquaredTo(rc.getLocation())>40){
rc.pack();
}
else if(rc.isWeaponReady()){
RESOURCE_FUNCTIONS.attackWeakestEnemy();
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
}

private class TTM{

//MapLocation enemyLocation;
public MapLocation enemyArchonLocation;
//public boolean goOffense;

public TTM(){

}

public void run(){
while(true){
try{

if(rc.isWeaponReady()){
enemyLocation = RESOURCE_FUNCTIONS.locateStrongestEnemy();
if(rc.canAttackLocation(enemyLocation)){
rc.attackLocation(enemyLocation);
Signal[] signals = rc.emptySignalQueue();
if (signals.length > 0) {
for (Signal s : signals) {
// receive a message containing enemy archon ID
if (s.getTeam() == ourTeam) {
FancyMessage f = FancyMessage.getFromRecievedSignal(s);
if(f.type == 2){
int xPos = f.ints.first;
int yPos = f.ints.second;
enemyArchonLocation = new MapLocation(xPos, yPos);
}
}
}
}
if(enemyArchonLocation.distanceSquaredTo(rc.getLocation())<40){
rc.unpack();
}

if(rc.isCoreReady()){
RESOURCE_FUNCTIONS.BUG(enemyArchonLocation);
}
}
catch (Exception e) {
e.printStackTrace();
}
}
}
}

/**
* Class Soldier
*
Expand Down