Package horizons :: Package ai :: Package aiplayer :: Package building :: Module farm :: Class ModifiedFieldEvaluator
[hide private]
[frames] | no frames]

Class ModifiedFieldEvaluator

source code

buildingevaluator.BuildingEvaluator --+
                                      |
                                     ModifiedFieldEvaluator

This evaluator evaluates the cost of changing the type of an unused field.

Instance Methods [hide private]
 
__init__(self, area_builder, builder, value, old_field_purpose) source code
 
execute(self)
Build the specified building complex.
source code
    Inherited from buildingevaluator.BuildingEvaluator
 
__str__(self) source code
 
_register_builder_position(self) source code
 
have_resources(self)
Return None if the builder is unreachable by road, False if there are not enough resources, and True otherwise.
source code
 
purpose(self)
Return the BUILDING_PURPOSE constant relevant to the builder.
source code
Class Methods [hide private]
 
create(cls, area_builder, x, y, new_field_purpose) source code
    Inherited from buildingevaluator.BuildingEvaluator
 
_distance_to_nearest_building(cls, area_builder, builder, building_id)
Return the shortest distance to a building of type building_id that is in range of the builder.
source code
 
_distance_to_nearest_collector(cls, production_builder, builder, must_be_in_range=True)
Return the shortest distance to a collector that (usually) has to be in range of the builder.
source code
 
_get_alignment(cls, area_builder, coords_list)
Return an alignment value based on the outline of the given coordinates list.
source code
 
_get_alignment_from_outline(cls, area_builder, outline_coords_list)
Return an alignment value given the list of coordinates that form the outline of a shape.
source code
 
_get_outline_coords_list(cls, coords_list)
Return the list of coordinates that share sides the given coordinates list.
source code
 
_weighted_distance(cls, main_component, other_components, none_value)
Return the weights sum of the component distances with the specified weights.
source code
 
get_best_evaluator(cls, evaluators) source code
Class Variables [hide private]
    Inherited from buildingevaluator.BuildingEvaluator
  log = logging.getLogger("ai.aiplayer.buildingevaluator")
  need_collector_connection = True
  record_plan_change = True
Method Details [hide private]

__init__(self, area_builder, builder, value, old_field_purpose)
(Constructor)

source code 
Parameters:
  • area_builder - the relevant AreaBuilder instance
  • builder - Builder instance
  • value - the value of the evaluator (bigger is better)
Overrides: buildingevaluator.BuildingEvaluator.__init__
(inherited documentation)

execute(self)

source code 

Build the specified building complex. Return (BUILD_RESULT constant, building object).

Overrides: buildingevaluator.BuildingEvaluator.execute
(inherited documentation)