-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSlanderers.java
More file actions
33 lines (27 loc) · 987 Bytes
/
Slanderers.java
File metadata and controls
33 lines (27 loc) · 987 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
package Maloneplayer;
import battlecode.common.*;
public class Slanderers extends Unit{
public Slanderers(RobotController r) {
super(r);
}
public void takeTurn() throws GameActionException {
super.takeTurn();
actionPerformed = "No Action";
if (rc.getType() == RobotType.SLANDERER) {
lookForEnemies(); //updates if any units of interest are nearby
if(enemyMuckrakersNearby){
actionPerformed = "Running away from muckrakers";
tryMove(rc.getLocation().directionTo(getHuntLoc(RobotType.MUCKRAKER,enemy)).opposite());
}
else if(homeCenter!=null){
actionPerformed = "Staying Home";
goTo(homeCenter);
}else {
tryMove(randomDirection());
actionPerformed = "Moved randomly";
}
}else if(rc.getType() == RobotType.POLITICIAN){
runPolitian();
}
}
}