Created
November 10, 2016 21:17
-
-
Save popey456963/c549c94e5cc90084996c411b64b2cd24 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from hlt import * | |
from networking import * | |
myID, gameMap = getInit() | |
sendInit("PythonBot") | |
while True: | |
moves = [] | |
gameMap = getFrame() | |
for y in range(gameMap.height): | |
for x in range(gameMap.width): | |
if gameMap.getSite(Location(x, y)).owner == myID: | |
movedPiece = False | |
if not movedPiece and gameMap.getSite(Location(x, y)).strength < gameMap.getSite(Location(x, y)).production * 5: | |
moves.append(Move(Location(x, y), STILL)) | |
movedPiece = True | |
if not movedPiece: | |
moves.append(Move(Location(x, y), NORTH if bool(int(random.random() * 2)) else WEST)) | |
movedPiece = True | |
sendFrame(moves) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment