Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- for (; ; ) {
- game.updateFrame();
- final Player me = game.me;
- final GameMap gameMap = game.gameMap;
- final ArrayList<Command> commandQueue = new ArrayList<>();
- me.shipyard.spawn();
- Ship myShip = me.ships.get(0);
- int maxHalite = 0;
- Direction currentDirection = gameMap.naiveNavigate(myShip, me.shipyard.position);
- boolean farm = false;
- for (Direction direction : Direction.ALL_CARDINALS) {
- Position position = myShip.position;
- int currentHalite = gameMap.at(position.directionalOffset(direction)).halite;
- if (currentHalite > maxHalite && currentHalite > myShip.halite && myShip.halite < 500) {
- maxHalite = currentHalite;
- currentDirection = direction;
- farm = true;
- }
- }
- if(farm == true) {
- commandQueue.add(myShip.stayStill());
- } else {
- commandQueue.add(myShip.move(currentDirection));
- }
- game.endTurn(commandQueue);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement