This repository was archived by the owner on Dec 3, 2018. It is now read-only.
- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStarterBot.java
More file actions
Latest commit
52 lines (40 loc) · 1.68 KB
/
Copy pathStarterBot.java
File metadata and controls
52 lines (40 loc) · 1.68 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
importhlt.*;
importjava.util.ArrayList;
publicclassStarterBot {
publicstaticvoidmain(finalString[] args) {
finalNetworkingnetworking = newNetworking();
finalGameMapgameMap = networking.initialize("StarterBot");
// We now have 1 full minute to analyse the initial map.
finalStringinitialMapIntelligence =
"width: " + gameMap.getWidth() +
"; height: " + gameMap.getHeight() +
"; players: " + gameMap.getAllPlayers().size() +
"; planets: " + gameMap.getAllPlanets().size();
Log.log(initialMapIntelligence);
finalArrayList<Move> moveList = newArrayList<>();
for (;;) {
moveList.clear();
networking.updateMap(gameMap);
for (finalShipship : gameMap.getMyPlayer().getShips().values()) {
if (ship.getDockingStatus() != Ship.DockingStatus.Undocked) {
continue;
}
for (finalPlanetplanet : gameMap.getAllPlanets().values()) {
if (planet.isOwned()) {
continue;
}
if (ship.canDock(planet)) {
moveList.add(newDockMove(ship, planet));
break;
}
finalThrustMovenewThrustMove = Navigation.navigateShipToDock(gameMap, ship, planet, Constants.MAX_SPEED/2);
if (newThrustMove != null) {
moveList.add(newThrustMove);
}
break;
}
}
Networking.sendMoves(moveList);
}
}
}