-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRobotPlayer.java
More file actions
39 lines (35 loc) · 1.15 KB
/
RobotPlayer.java
File metadata and controls
39 lines (35 loc) · 1.15 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
package Maloneplayer;
import battlecode.common.*;
public strictfp class RobotPlayer {
/**
* run() is the method that is called when a robot is instantiated in the Battlecode world.
* If this method returns, the robot dies!
**/
public static void run(RobotController rc) throws GameActionException {
Robot me = null;
switch (rc.getType()) {
case ENLIGHTENMENT_CENTER:
me = new EnlightenmentCenter(rc);
break;
case POLITICIAN:
me = new Politicians(rc);
break;
case SLANDERER:
me = new Slanderers(rc);
break;
case MUCKRAKER:
me = new Muckrakers(rc);
break;
}
while (true) {
try {
me.takeTurn();
// Clock.yield() makes the robot wait until the next turn, then it will perform this loop again
Clock.yield();
} catch (Exception e) {
System.out.println(rc.getType() + " Exception"); // darn
e.printStackTrace();
}
}
}
}