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

Class ProductionChainSubtreeChoice

source code

An object of this class represents a choice between N >= 1 ways of producing the required resource.

Instance Methods [hide private]
 
__init__(self, options) source code
 
assign_identifier(self, prefix)
Recursively assign an identifier to this subtree to know which subtree owns which resource quota.
source code
 
__str__(self, level=0) source code
 
get_root_import_level(self)
Return the amount of the resource imported per tick.
source code
 
get_final_production_level(self)
Return the total reserved production capacity of the resource per tick (includes import).
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_available_options(self)
Return a list of the currently available options to produce the resource.
source code
 
build(self, amount)
Try to build a building in the subtree that is currently the cheapest.
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 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
Class Variables [hide private]
  log = logging.getLogger("ai.aiplayer.productionchain")
  coverage_resources = {RES.COMMUNITY, RES.FAITH, RES.EDUCATION,...
Method Details [hide private]

build(self, amount)

source code 

Try to build a building in the subtree that is currently the cheapest. Return a BUILD_RESULT constant.

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.


Class Variable Details [hide private]

coverage_resources

Value:
{RES.COMMUNITY, RES.FAITH, RES.EDUCATION, RES.GET_TOGETHER}