-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMuckrakers.java
More file actions
56 lines (43 loc) · 1.52 KB
/
Muckrakers.java
File metadata and controls
56 lines (43 loc) · 1.52 KB
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
package Maloneplayer;
import battlecode.common.*;
public class Muckrakers extends Unit {
public Muckrakers(RobotController r) {
super(r);
}
public void takeTurn() throws GameActionException {
super.takeTurn();
actionPerformed = "No Action";
//Check for slanderers to kill
int actionRadius = rc.getType().actionRadiusSquared;
for (RobotInfo robot : rc.senseNearbyRobots(actionRadius, enemy)) {
if (robot.type.canBeExposed()) {
// It's a slanderer... go get them!
if (rc.canExpose(robot.location)) {
actionPerformed = "Exposed a Slanderer";
rc.expose(robot.location);
rc.setIndicatorLine(rc.getLocation(),robot.location, 252, 248, 3);
return;
}
}
}
//Determine where to gso
lookForEnemies();
if(enemySlandererNearby){
targetLoc=getHuntLoc(RobotType.SLANDERER, enemy); //Move towards Slanderers
actionPerformed = "Moving toward enemy Slanderer";
}else if(enemyCenter !=null){
targetLoc= enemyCenter;
actionPerformed = "Moving toward enemy Center";
} else{
targetLoc=explore();
actionPerformed = "Exploring";
}
//Move
if(targetLoc != null) {
goTo(targetLoc);
}else{
actionPerformed = "Moved randomly";
tryMove(randomDirection());
}
}
}