parameters: ()
return_statement: return chosen_locations
docstring: Find possible locations for the BLD_AUTO_HISTORY_ANALYSER building and return a subset of chosen building locations.
  
      :return: Random possible locations up to max queueable amount. Empty if no location found or can't queue another one
docstring_summary: Find possible locations for the BLD_AUTO_HISTORY_ANALYSER building and return a subset of chosen building locations.
docstring_tokens: Find possible locations for the BLD_AUTO_HISTORY_ANALYSER building and return a subset of chosen building locations .
function: def find_automatic_historic_analyzer_candidates() -> List[int]:
      """
      Find possible locations for the BLD_AUTO_HISTORY_ANALYSER building and return a subset of chosen building locations.
  
      :return: Random possible locations up to max queueable amount. Empty if no location found or can't queue another one
      """
      empire = fo.getEmpire()
      universe = fo.getUniverse()
      total_pp = empire.productionPoints
      history_analyser = "BLD_AUTO_HISTORY_ANALYSER"
      culture_archives = "BLD_CULTURE_ARCHIVES"
  
      ARB_LARGE_NUMBER = 1e4
      conditions = {
          # aggression: (min_pp, min_turn, min_pp_to_queue_another_one)
          fo.aggression.beginner: (100, 100, ARB_LARGE_NUMBER),
          fo.aggression.turtle: (75, 75, ARB_LARGE_NUMBER),
          fo.aggression.cautious: (40, 40, ARB_LARGE_NUMBER),
          fo.aggression.typical: (20, 20, 50),
          fo.aggression.aggressive: (10, 10, 40),
          fo.aggression.maniacal: (8, 5, 30),
      }
  
      min_pp, turn_trigger, min_pp_per_additional = conditions.get(
          get_aistate().character.get_trait(Aggression).key, (ARB_LARGE_NUMBER, ARB_LARGE_NUMBER, ARB_LARGE_NUMBER)
      )
      max_enqueued = 1 if total_pp > min_pp or fo.currentTurn() > turn_trigger else 0
      max_enqueued += int(total_pp / min_pp_per_additional)
  
      if max_enqueued <= 0:
          return []
  
      # find possible locations
      possible_locations = set()
      for pid in get_all_empire_planets():
          planet = universe.getPlanet(pid)
          if not planet or planet.currentMeterValue(fo.meterType.targetPopulation) < 1:
              continue
          buildings_here = [bld.buildingTypeName for bld in map(universe.getBuilding, planet.buildingIDs)]
          if planet and culture_archives in buildings_here and history_analyser not in buildings_here:
              possible_locations.add(pid)
  
      # check existing queued buildings and remove from possible locations
      queued_locs = {
          e.locationID
          for e in empire.productionQueue
          if e.buildType == EmpireProductionTypes.BT_BUILDING and e.name == history_analyser
      }
  
      possible_locations -= queued_locs
      chosen_locations = []
      for i in range(min(max_enqueued, len(possible_locations))):
          chosen_locations.append(possible_locations.pop())
      return chosen_locations
function_tokens: def find_automatic_historic_analyzer_candidates ( ) -> List [ int ] : empire = fo . getEmpire ( ) universe = fo . getUniverse ( ) total_pp = empire . productionPoints history_analyser = "BLD_AUTO_HISTORY_ANALYSER" culture_archives = "BLD_CULTURE_ARCHIVES" ARB_LARGE_NUMBER = 1e4 conditions = { # aggression: (min_pp, min_turn, min_pp_to_queue_another_one) fo . aggression . beginner : ( 100 , 100 , ARB_LARGE_NUMBER ) , fo . aggression . turtle : ( 75 , 75 , ARB_LARGE_NUMBER ) , fo . aggression . cautious : ( 40 , 40 , ARB_LARGE_NUMBER ) , fo . aggression . typical : ( 20 , 20 , 50 ) , fo . aggression . aggressive : ( 10 , 10 , 40 ) , fo . aggression . maniacal : ( 8 , 5 , 30 ) , } min_pp , turn_trigger , min_pp_per_additional = conditions . get ( get_aistate ( ) . character . get_trait ( Aggression ) . key , ( ARB_LARGE_NUMBER , ARB_LARGE_NUMBER , ARB_LARGE_NUMBER ) ) max_enqueued = 1 if total_pp > min_pp or fo . currentTurn ( ) > turn_trigger else 0 max_enqueued += int ( total_pp / min_pp_per_additional ) if max_enqueued <= 0 : return [ ] # find possible locations possible_locations = set ( ) for pid in get_all_empire_planets ( ) : planet = universe . getPlanet ( pid ) if not planet or planet . currentMeterValue ( fo . meterType . targetPopulation ) < 1 : continue buildings_here = [ bld . buildingTypeName for bld in map ( universe . getBuilding , planet . buildingIDs ) ] if planet and culture_archives in buildings_here and history_analyser not in buildings_here : possible_locations . add ( pid ) # check existing queued buildings and remove from possible locations queued_locs = { e . locationID for e in empire . productionQueue if e . buildType == EmpireProductionTypes . BT_BUILDING and e . name == history_analyser } possible_locations -= queued_locs chosen_locations = [ ] for i in range ( min ( max_enqueued , len ( possible_locations ) ) ) : chosen_locations . append ( possible_locations . pop ( ) ) return chosen_locations