Example #1
0
                    time_rangers += (time.time() - start_time)
                except Exception as e:
                    #print('RANGER ERROR.')
                    if ranger in variables.ranger_roles["go_to_mars"]:
                        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
Example #2
0
            if unit.unit_type == bc.UnitType.Worker:
                worker.timestep(gc, unit, info, karbonite_locations,
                                locs_next_to_terrain, blueprinting_queue,
                                building_assignment, current_worker_roles)
            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)