def main(): map_data = '' universe = Universe() while(True): current_line = raw_input() if len(current_line) >= 2 and current_line.startswith("go"): universe = parse_game_state(universe, map_data) do_turn(universe) finish_turn() map_data = '' else: map_data += current_line + '\n'
# You don't need to change this function def do_turn(state): behavior_tree.execute(planet_wars) if __name__ == '__main__': logging.basicConfig(filename=__file__[:-3] + '.log', filemode='w', level=logging.DEBUG) behavior_tree = setup_behavior_tree() try: map_data = '' while True: current_line = input() if len(current_line) >= 2 and current_line.startswith("go"): planet_wars = PlanetWars(map_data) do_turn(planet_wars) finish_turn() map_data = '' else: map_data += current_line + '\n' except KeyboardInterrupt: print('ctrl-c, leaving ...') except Exception: traceback.print_exc(file=sys.stdout) logging.exception("Error in bot.")
issue_order(state, my_planet.ID, target_planet.ID, required_ships) my_planet = next(my_planets) target_planet = next(target_planets) else: target_planet = next(target_planets) except StopIteration: return if __name__ == '__main__': logging.basicConfig(filename=__file__[:-3] +'.log', filemode='w', level=logging.DEBUG) try: map_data = '' while True: current_line = input() if len(current_line) >= 2 and current_line.startswith("go"): planet_wars = PlanetWars(map_data) do_turn(planet_wars) finish_turn() map_data = '' else: map_data += current_line + '\n' except KeyboardInterrupt: print('ctrl-c, leaving ...') except: traceback.print_exc(file=sys.stdout) logging.exception("Error in bot.")
def surrender(state): finish_turn() return True