Advertisement
Guest User

Untitled

a guest
Nov 17th, 2019
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.16 KB | None | 0 0
  1. for (; ; ) {
  2. game.updateFrame();
  3. final Player me = game.me;
  4. final GameMap gameMap = game.gameMap;
  5.  
  6. final ArrayList<Command> commandQueue = new ArrayList<>();
  7.  
  8. me.shipyard.spawn();
  9. Ship myShip = me.ships.get(0);
  10. int maxHalite = 0;
  11. Direction currentDirection = gameMap.naiveNavigate(myShip, me.shipyard.position);
  12. boolean farm = false;
  13. for (Direction direction : Direction.ALL_CARDINALS) {
  14. Position position = myShip.position;
  15. int currentHalite = gameMap.at(position.directionalOffset(direction)).halite;
  16. if (currentHalite > maxHalite && currentHalite > myShip.halite && myShip.halite < 500) {
  17. maxHalite = currentHalite;
  18. currentDirection = direction;
  19. farm = true;
  20. }
  21. }
  22. if(farm == true) {
  23. commandQueue.add(myShip.stayStill());
  24. } else {
  25. commandQueue.add(myShip.move(currentDirection));
  26. }
  27. game.endTurn(commandQueue);
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement