Example #1
0
class MyBot:
    def __init__(self):
        """Add our log filter so that botversion and turn number are output correctly"""
        log_filter = LogFilter()
        getLogger().addFilter(log_filter)

    # do_setup is run once at the start of the game
    # after the bot has received the game settings
    # the ants class is created and setup by the Ants.run method
    def do_setup(self, ants):
        self.initialized = False

    # do turn is run once per turn
    # the ants class has the game state and is updated by the Ants.run method
    # it also has several helper methods to use
    def do_turn(self, ants):
        global turn_number
        if not self.initialized:
            self.colony = Colony(ants)
            self.initialized = True
        else:
            self.colony.move(ants)
        turn_number = turn_number + 1

        """