elif unit.unit_type == bc.UnitType.Knight: knight.timestep(gc, unit, info, knight_to_cluster, seen_knights_ids, KNIGHT_CLUSTER_MIN) elif unit.unit_type == bc.UnitType.Ranger: ranger.timestep(gc, unit, info, last_turn_battle_locs, next_turn_battle_locs, queued_paths, ranger_roles) elif unit.unit_type == bc.UnitType.Mage: mage.timestep(gc, unit, info, last_turn_battle_locs, next_turn_battle_locs, queued_paths) elif unit.unit_type == bc.UnitType.Healer: healer.timestep(gc, unit, info, last_turn_battle_locs) elif unit.unit_type == bc.UnitType.Factory: factory.timestep(gc, unit, info, building_assignment, mining_rate=3 * len(current_worker_roles["miner"])) elif unit.unit_type == bc.UnitType.Rocket: rocket.timestep(gc, unit, info) ## Reset knight turn clusters seen_knights_ids = set() except Exception as e: print('Error:', e) # use this to show where the error was traceback.print_exc() # send the actions we've performed, and wait for our next turn. gc.next_turn()
variables.ranger_roles["go_to_mars"].remove(ranger) elif ranger in variables.ranger_roles["fighter"]: variables.ranger_roles["fighter"].remove(ranger) elif ranger in variables.ranger_roles["sniper"]: variables.ranger_roles["sniper"].remove(ranger) traceback.print_exc() elif unit.unit_type == unit_types["mage"]: mage.timestep(unit) elif unit.unit_type == unit_types["healer"]: start_time = time.time() healer.timestep(unit) time_healers += (time.time() - start_time) elif unit.unit_type == unit_types["factory"]: start_time = time.time() factory.timestep(unit) time_factories += time.time() - start_time elif unit.unit_type == unit_types["rocket"]: #start_time = time.time() rocket.timestep(unit) #time_knights+=(time.time()-start_time) # if gc.planet() == bc.Planet.Mars: # print('ranger roles: ', variables.ranger_roles) # if gc.planet() == bc.Planet.Earth: # print("QUADRANTS: ", variables.quadrant_battle_locs) # locs_correct = True # for unit in gc.my_units(): # if unit.id in variables.unit_locations: # loc_coords = (unit.location.map_location().x, unit.location.map_location().y) # recorded = variables.unit_locations[unit.id]
elif unit.unit_type == bc.UnitType.Ranger: ranger.timestep(gc, unit, info, last_turn_battle_locs, next_turn_battle_locs, queued_paths, ranger_roles, constants, direction_to_coord, precomputed_bfs) elif unit.unit_type == bc.UnitType.Mage: mage.timestep(gc, unit, info, last_turn_battle_locs, next_turn_battle_locs, queued_paths) elif unit.unit_type == bc.UnitType.Healer: healer.timestep(gc, unit, info, last_turn_battle_locs, constants) elif unit.unit_type == bc.UnitType.Factory: factory.timestep(gc, unit, info, building_assignment, last_turn_battle_locs, constants, mining_rate=3 * len(current_worker_roles["miner"])) elif unit.unit_type == bc.UnitType.Rocket: # print('hi') rocket.timestep(gc, unit, info, rocket_launch_times, rocket_landing_sites) ## Reset knight turn clusters seen_knights_ids = set() except Exception as e: print('Error:', e) # use this to show where the error was traceback.print_exc()