Package horizons :: Package ai :: Package aiplayer :: Module productionchain :: Class ProductionChainSubtree
[hide private]
[frames] | no frames]

Class ProductionChainSubtree

source code

An object of this type represents a subtree of buildings that need to be built in order to produce the given resource.

Instance Methods [hide private]
 
__init__(self, settlement_manager, resource_id, production_line, abstract_building, children, production_ratio) source code
 
assign_identifier(self, prefix)
Recursively assign an identifier to this subtree to know which subtree owns which resource quota.
source code
 
available(self)
Return a boolean showing whether this subtree is currently available.
source code
 
__str__(self, level=0) source code
 
get_expected_children_cost(self, amount)
Return the expected utility cost of building enough buildings in the subtrees to produce a total of the given amount of the resource per tick.
source code
 
get_expected_cost(self, amount)
Return the expected utility cost of building enough buildings to produce a total of the given amount of the resource per tick.
source code
 
get_root_production_level(self)
Return the currently reserved production capacity of this subtree at the root.
source code
 
get_final_production_level(self)
Return the currently reserved production capacity at the bottleneck.
source code
 
need_more_buildings(self, amount)
Return a boolean showing whether more buildings of this specific type need to be built in order to produce at least the given amount of resource per tick.
source code
 
build(self, amount)
Build a building in order to get closer to the goal of producing at least the given amount of resource per tick at the bottleneck.
source code
 
reserve(self, amount, may_import)
Reserve currently available production capacity and import from other islands if allowed.
source code
 
need_to_build_more_buildings(self, amount)
Return a boolean showing whether more buildings in this subtree need to be built in order to produce at least the given amount of resource per tick.
source code
 
get_ratio(self, resource_id)
Return the ratio of the given resource needed given that 1 unit of the root resource is required.
source code
Method Details [hide private]

available(self)

source code 

Return a boolean showing whether this subtree is currently available.

Decorators:
  • @property

reserve(self, amount, may_import)

source code 

Reserve currently available production capacity and import from other islands if allowed. Returns the total amount it can reserve or import.