- Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMyBot.java
More file actions
Latest commit
28 lines (23 loc) · 875 Bytes
/
Copy pathMyBot.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
importhlt.GameMap;
importhlt.Log;
importhlt.Move;
importhlt.Networking;
importstrategy.AbstractStrategy;
importstrategy.StrategyFactory;
importjava.util.LinkedList;
importjava.util.List;
publicclassMyBot {
publicstaticvoidmain(finalString[] args) {
finalNetworkingnetworking = newNetworking();
finalGameMapgameMap = networking.initialize("n1try-basic-v1.14");
List<Move> lastMoves = newLinkedList<>();
AbstractStrategycurrentStrategy = 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);
}
}
}