Exemplo n.º 1
0
my_team = gc.team()

while True:
    #print('pyround:', gc.round(), 'time left:', gc.get_time_left_ms(), 'ms')
    researcher.research()
    try:
        for unit in gc.my_units():
            # first, factory logic
            if unit.unit_type == bc.UnitType.Factory:
                factoryMgr.handle(unit)
                continue
            elif unit.unit_type == bc.UnitType.Rocket:
                rocketMgr.handle(unit)
                continue
            elif unit.unit_type == bc.UnitType.Rocket:
                launcher.handle(unit)
                continue
            elif unit.unit_type == bc.UnitType.Worker:
                workerMgr.handle(unit)
            elif unit.unit_type == bc.UnitType.Ranger:
                rangerMgr.handle(unit)
            elif unit.unit_type == bc.UnitType.Mage:
                mageMgr.handle(unit)
            elif unit.unit_type == bc.UnitType.Healer:
                healerMgr.handle(unit)
    except Exception as e:
        print('Error:', e)
        traceback.print_exc()
        raise e
    gc.next_turn()
    sys.stdout.flush()