Skip to content

Instantly share code, notes, and snippets.

@git2samus
Forked from anonymous/bot.py
Last active November 13, 2015 20:31
Show Gist options
  • Save git2samus/dc22893a78181f3a136d to your computer and use it in GitHub Desktop.
Save git2samus/dc22893a78181f3a136d to your computer and use it in GitHub Desktop.
from gamebot import GameBot
class Bot(GameBot):
# Possible directions where a unit can move to
# self.NW, self.N, self.NE, self.E, self.SE, self.S, self.SW, self.W
# game_map : Is a python dictionary:
# - key = (x, y) that indicates a coordinate. x and y are integers.
# - value = a Tile object.
# Tile object attributes:
# own_hq: Boolean. Indicates that this tile is our own base
# enemies_count: Integer. Indicate the amount of enemies in the tile
# enemy_hq: Boolean. Indicates that the enemy HQ is present in the tile.
# units: list of units objects currently on that tile.
# reachable: boolean. Indicates that this tile is not a blocker.
# x: integer. The x coordinate
# y: integer. The y coordinate
# Unit Object attributes:
# x, y: integers. Analog to the x, y attributes in Tile object.
# unit_id: integer: Indicates the id of the unit.
# Usefull methods:
# self.attack(tile, direction): Attack from one tile in a certain
# direction. The direction must be one of the possible defined above.
# self.move(unit, direction): Move a unit from its current
# position in a certain direction. The direction must be one of the
# possible defined above. IE: self.move(unit_id, self.N)
def play(self, player_id, game_map):
"""
Method were the player can develop its strategy using the player_id
and the game_map as input.
"""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment