Something went wrong. Try again.
[READ-ONLY] Mirror of https://github.com/just-cameron/misc-python. All my Python code for class or other things.
Something went wrong. Try again.
12345678910111213141516171819202122232425262728import hltfrom hlt import NORTH, EAST, SOUTH, WEST, STILL, Move, Squareimport random
myID, game_map = hlt.get_init()hlt.send_init("Best Bot")
def assign_move(square): for direction, neighbor in enumerate(game_map.neighbors(square)): if neighbor.owner != myID and neighbor.strength < square.strength and neighbor.production > square.production: return Move(square, direction) if neighbor.owner != myID and neighbor.strength < square.strength: return Move(square, direction) if neighbor.owner != myID and neighbor.strength < square.strength + square.production: return Move(square, STILL) if square.strength < 5 * square.production: return Move(square, STILL) elif square.strength == 255: return Move(square, EAST) else: return Move(square, random.choice((NORTH, STILL)))
while True: game_map.get_frame() moves = [assign_move(square) for square in game_map if square.owner == myID] hlt.send_frame(moves)