parameters: ()
return_statement: return exploration_priority
docstring: Calculates the demand for scouts by unexplored systems.
docstring_summary: Calculates the demand for scouts by unexplored systems.
docstring_tokens: Calculates the demand for scouts by unexplored systems .
function: def _calculate_exploration_priority():
      """Calculates the demand for scouts by unexplored systems."""
      empire = fo.getEmpire()
      num_unexplored_systems = len(ExplorationAI.border_unexplored_system_ids)
      aistate = get_aistate()
      num_scouts = sum(
          [
              aistate.fleetStatus.get(fid, {}).get("nships", 0)
              for fid in FleetUtilsAI.get_empire_fleet_ids_by_role(MissionType.EXPLORATION)
          ]
      )
      production_queue = empire.productionQueue
      queued_scout_ships = 0
      for queue_index in range(0, len(production_queue)):
          element = production_queue[queue_index]
          if element.buildType == EmpireProductionTypes.BT_SHIP:
              if aistate.get_ship_role(element.designID) == ShipRoleType.CIVILIAN_EXPLORATION:
                  queued_scout_ships += element.remaining * element.blocksize
  
      mil_ships = MilitaryAI.get_num_military_ships()
      # intent of the following calc is essentially
      # new_scouts_needed = min(need_cap_A, need_cap_B, base_need) - already_got_or_queued
      # where need_cap_A is to help prevent scouting needs from swamping military needs, and
      # need_cap_B is to help regulate investment into scouting while the empire is small.
      # These caps could perhaps instead be tied more directly to military priority and
      # total empire production.
      desired_number_of_scouts = int(
          min(4 + mil_ships / 5, 4 + fo.currentTurn() / 50.0, 2 + num_unexplored_systems ** 0.5)
      )
      scouts_needed = max(0, desired_number_of_scouts - (num_scouts + queued_scout_ships))
      exploration_priority = int(40 * scouts_needed)
  
      debug("")
      debug("Number of Scouts: %s" % num_scouts)
      debug("Number of Unexplored systems: %s" % num_unexplored_systems)
      debug("Military size: %s" % mil_ships)
      debug("Priority for scouts: %s" % exploration_priority)
  
      return exploration_priority
function_tokens: def _calculate_exploration_priority ( ) : empire = fo . getEmpire ( ) num_unexplored_systems = len ( ExplorationAI . border_unexplored_system_ids ) aistate = get_aistate ( ) num_scouts = sum ( [ aistate . fleetStatus . get ( fid , { } ) . get ( "nships" , 0 ) for fid in FleetUtilsAI . get_empire_fleet_ids_by_role ( MissionType . EXPLORATION ) ] ) production_queue = empire . productionQueue queued_scout_ships = 0 for queue_index in range ( 0 , len ( production_queue ) ) : element = production_queue [ queue_index ] if element . buildType == EmpireProductionTypes . BT_SHIP : if aistate . get_ship_role ( element . designID ) == ShipRoleType . CIVILIAN_EXPLORATION : queued_scout_ships += element . remaining * element . blocksize mil_ships = MilitaryAI . get_num_military_ships ( ) # intent of the following calc is essentially # new_scouts_needed = min(need_cap_A, need_cap_B, base_need) - already_got_or_queued # where need_cap_A is to help prevent scouting needs from swamping military needs, and # need_cap_B is to help regulate investment into scouting while the empire is small. # These caps could perhaps instead be tied more directly to military priority and # total empire production. desired_number_of_scouts = int ( min ( 4 + mil_ships / 5 , 4 + fo . currentTurn ( ) / 50.0 , 2 + num_unexplored_systems ** 0.5 ) ) scouts_needed = max ( 0 , desired_number_of_scouts - ( num_scouts + queued_scout_ships ) ) exploration_priority = int ( 40 * scouts_needed ) debug ( "" ) debug ( "Number of Scouts: %s" % num_scouts ) debug ( "Number of Unexplored systems: %s" % num_unexplored_systems ) debug ( "Military size: %s" % mil_ships ) debug ( "Priority for scouts: %s" % exploration_priority ) return exploration_priority