import freeOrionAIInterface as fo # pylint: disable=import-error import ColonisationAI from AIDependencies import INVALID_ID from common.configure_logging import convenience_function_references_for_logger (debug, info, warn, error, fatal) = convenience_function_references_for_logger(__name__) def safe_name(univ_object): return (univ_object and univ_object.name) or "?" def sys_name_ids(sys_ids): """ Get list of text representing pairs system name and system id. :param sys_ids: list if system ids :return: list of string <name>:<id> """ universe = fo.getUniverse() return [str(universe.getSystem(sys_id)) for sys_id in sys_ids] def planet_name_ids(planet_ids): """ Get list of text representing pairs planet name and system id. :param planet_ids: list if planet ids :return: list of string <name>:<id> """ universe = fo.getUniverse() return [fo.to_str('P', planet_id, safe_name(universe.getPlanet(planet_id))) for planet_id in planet_ids]
from collections import namedtuple from freeorion_tools import ReadOnlyDict import freeOrionAIInterface as fo from common.configure_logging import convenience_function_references_for_logger (debug, info, warn, error, fatal) = convenience_function_references_for_logger(__name__) PlanetInfo = namedtuple('PlanetInfo', ['pid', 'species_name', 'owner', 'system_id']) class State(object): """ This class represent state for current turn. It contains variables that renewed each turn. Before each turn `update` method should be called at the beginning of each turn. Each variable should have a getter that returns value or deepcopy of value if it is immutable and one or couple setters (if need to change inner collections in collection). This behaviour is similar for `freeorion_tools` but all to change state from external location. """ def __init__(self): self.__have_gas_giant = False self.__have_asteroids = False self.__have_ruins = False self.__have_nest = False self.__have_computronium = False self.__best_pilot_rating = 1e-8 self.__medium_pilot_rating = 1e-8
from EnumsAI import ShipRoleType, MissionType import AIstate import FleetUtilsAI import freeOrionAIInterface as fo # pylint: disable=import-error import FreeOrionAI as foAI import MilitaryAI import MoveUtilsAI import PlanetUtilsAI import CombatRatingsAI from universe_object import Fleet, System, Planet from AIDependencies import INVALID_ID from freeorion_tools import get_partial_visibility_turn from common.configure_logging import convenience_function_references_for_logger (debug, info, warn, error, fatal) = convenience_function_references_for_logger(__name__) dumpTurn = 0 def trooper_move_reqs_met(main_fleet_mission, order, verbose): """ Indicates whether or not move requirements specific to invasion troopers are met for the provided mission and order. :type main_fleet_mission: AIFleetMission.AIFleetMission :type order: OrderMove :param verbose: whether to print verbose decision details :type verbose: bool :rtype: bool """ # Don't advance outside of our fleet-supply zone unless the target either has no shields at all or there # is already a military fleet assigned to secure the target, and don't take final jump unless the planet is # (to the AI's knowledge) down to zero shields. Additional checks will also be done by the later