Advertisement
Guest User

Untitled

a guest
Dec 10th, 2016
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. import hlt
  2. from hlt import NORTH, EAST, SOUTH, WEST, STILL, Move, Square
  3. import random
  4.  
  5.  
  6. myID, game_map = hlt.get_init()
  7. hlt.send_init("RandomPythonBot")
  8.  
  9. def assign_move(square):
  10. if square.strength < 5 * square.production:
  11. return Move(square, STILL)
  12. else:
  13. return Move(square, random.choice((NORTH, EAST, SOUTH, WEST, STILL)))
  14.  
  15.  
  16. while True:
  17. game_map.get_frame()
  18. moves = [assign_move(square) for square in game_map if square.owner == myID]
  19. hlt.send_frame(moves)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement