Пример #1
0
import AIstate
import ColonisationAI
import ExplorationAI
import DiplomaticCorp
import FleetUtilsAI
import InvasionAI
import MilitaryAI
import PlanetUtilsAI
import PriorityAI
import ProductionAI
import ResearchAI
import ResourcesAI
from freeorion_tools import UserStringList, chat_on_error, print_error
from freeorion_debug import Timer

main_timer = Timer('timer', write_log=True)
turn_timer = Timer('bucket', write_log=True)

using_statprof = False
try:
    import statprof
    # statprof.start()
    # using_statprof = True
except:
    pass


_capitals = {fo.aggression.beginner: UserStringList("AI_CAPITOL_NAMES_BEGINNER"),
             fo.aggression.turtle: UserStringList("AI_CAPITOL_NAMES_TURTLE"),
             fo.aggression.cautious: UserStringList("AI_CAPITOL_NAMES_CAUTIOUS"),
             fo.aggression.typical: UserStringList("AI_CAPITOL_NAMES_TYPICAL"),
Пример #2
0
"""
# Note: The algorithm is not stable with respect to pid order.  i.e. Two empire with
#       exactly the same colonies, but different pids may make different choices.

import freeOrionAIInterface as fo  # pylint: disable=import-error
import FreeOrionAI as foAI
from EnumsAI import PriorityType, get_priority_resource_types, FocusType
import PlanetUtilsAI
import random
import ColonisationAI
import AIDependencies
import FleetUtilsAI
from freeorion_debug import Timer
from freeorion_tools import tech_is_complete

resource_timer = Timer('timer_bucket')

# Local Constants
INDUSTRY = FocusType.FOCUS_INDUSTRY
RESEARCH = FocusType.FOCUS_RESEARCH
MINING = FocusType.FOCUS_MINING  # not currently used in content
GROWTH = FocusType.FOCUS_GROWTH
PRODUCTION = FocusType.FOCUS_PROTECTION
_focus_names = {
    INDUSTRY: "Industry",
    RESEARCH: "Research",
    MINING: "Mining",
    GROWTH: "Growth",
    PRODUCTION: "Defense"
}
Пример #3
0
import freeOrionAIInterface as fo  # pylint: disable=import-error
import FreeOrionAI as foAI
import AIstate
import AIDependencies
import EnumsAI
import FleetUtilsAI
import PlanetUtilsAI
import AITarget
import math
import ProductionAI
import ColonisationAI
import MilitaryAI
from freeorion_tools import tech_is_complete
from freeorion_debug import Timer

invasion_timer = Timer('get_invasion_fleets()', write_log=False)


def get_invasion_fleets():
    invasion_timer.start("gathering initial info")

    all_invasion_fleet_ids = FleetUtilsAI.get_empire_fleet_ids_by_role(EnumsAI.AIFleetMissionType.FLEET_MISSION_INVASION)
    AIstate.invasionFleetIDs = FleetUtilsAI.extract_fleet_ids_without_mission_types(all_invasion_fleet_ids)

    # get suppliable planets
    universe = fo.getUniverse()
    empire = fo.getEmpire()
    empire_id = empire.empireID
    capital_id = PlanetUtilsAI.get_capital()
    homeworld=None
    if capital_id:
Пример #4
0
import AIstate
import ColonisationAI
import ExplorationAI
import FleetUtilsAI
import FreeOrionAI as foAI
import InvasionAI
import MilitaryAI
import PlanetUtilsAI
import EnumsAI
import ProductionAI
import ResearchAI
import AIDependencies
from freeorion_debug import Timer
from freeorion_tools import tech_is_complete

prioritiees_timer = Timer('calculate_priorities()')

allottedInvasionTargets=0
allottedColonyTargets=0
colony_growth_barrier = 2
scoutsNeeded = 0
unmetThreat = 0


def calculate_priorities():
    """calculates the priorities of the AI player"""
    print("checking statuses")
    # Industry, Research, Colony, Invasion, Military

    prioritiees_timer.start('setting Production Priority')
    foAI.foAIstate.set_priority(EnumsAI.AIPriorityType.PRIORITY_RESOURCE_PRODUCTION, 50) # let this one stay fixed & just adjust Research