-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMyBot.java
More file actions
28 lines (23 loc) · 875 Bytes
/
MyBot.java
File metadata and controls
28 lines (23 loc) · 875 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
import hlt.GameMap;
import hlt.Log;
import hlt.Move;
import hlt.Networking;
import strategy.AbstractStrategy;
import strategy.StrategyFactory;
import java.util.LinkedList;
import java.util.List;
public class MyBot {
public static void main(final String[] args) {
final Networking networking = new Networking();
final GameMap gameMap = networking.initialize("n1try-basic-v1.14");
List<Move> lastMoves = new LinkedList<>();
AbstractStrategy currentStrategy = null;
while (true) {
networking.updateMap(gameMap);
currentStrategy = StrategyFactory.chooseStrategy(gameMap, lastMoves, currentStrategy);
Log.log(String.format("Choose %s.", currentStrategy.getClass().getSimpleName()));
lastMoves = currentStrategy.apply();
Networking.sendMoves(lastMoves);
}
}
}