Package horizons :: Package ai :: Package aiplayer :: Package behavior :: Module behaviorcomponents :: Class BehaviorGood
[hide private]
[frames] | no frames]

Class BehaviorGood

source code

BehaviorComponent --+    
                    |    
   BehaviorDiplomatic --+
                        |
                       BehaviorGood

Diplomatic behavior. Good AI likes players that are:

Neutral towards:

Dislikes:

Instance Methods [hide private]
    Inherited from BehaviorDiplomatic
 
_choose_random_from_tuple(self, tuple)
Choose random action from tuple of (name, value)
source code
 
_get_action(self, relationship_score, **parameters) source code
 
_perform_action(self, action, **environment)
Execute action from actions Enum.
source code
 
allied_player(self, **environment) source code
 
calculate_relationship_score(self, balance, weights)
Calculate total relationship_score based on balances and their weights.
source code
 
handle_diplomacy(self, parameters, **environment)
Main function responsible for handling diplomacy.
source code
 
hostile_player(self, **environment)
Calculate balance, and change diplomacy towards a player to neutral or ally.
source code
 
neutral_player(self, **environment) source code
    Inherited from BehaviorComponent
 
__init__(self, owner) source code
 
_certainty_has_boat_builder(self, **environment) source code
 
_certainty_has_fleet(self, **environment) source code
 
certainty(self, action_name, **environment) source code
Class Methods [hide private]
    Inherited from BehaviorDiplomatic
lambda(x)
_get_quadratic_function(cls, mid, root, peek=1.0)
Functions for border distributions such as enemy or ally (left or right parabola).
source code
 
_move_f(cls, f, v_x, v_y)
Return function f moved by vector (v_x, v_y)
source code
 
get_ally_function(cls, root, peek=1.0) source code
 
get_enemy_function(cls, root, peek=1.0) source code
 
get_neutral_function(cls, mid, root, peek=1.0) source code
Class Variables [hide private]
  weights = {'power': 0.4, 'terrain': 0.4, 'wealth': 0.0,}
  parameters_hostile = {'neutral': {'mid':-2.0, 'root':-0.5, 'pe...
  parameters_neutral = {'ally': {'root': 4.0,}, 'enemy': {'root'...
  parameters_allied = {'neutral': {'mid':-3.0, 'root':-1.5, 'pee...
    Inherited from BehaviorDiplomatic
  actions = Enum('wait', 'war', 'peace', 'neutral')
  upper_boundary = 5.0
    Inherited from BehaviorComponent
  default_certainty = 1.0
  log = logging.getLogger('ai.aiplayer.behavior.behaviorcomponen...
  minimal_fleet_size = 1
Class Variable Details [hide private]

parameters_hostile

Value:
{'neutral': {'mid':-2.0, 'root':-0.5, 'peek': 0.2,}, 'ally': {'root': \
1.0,},}

parameters_neutral

Value:
{'ally': {'root': 4.0,}, 'enemy': {'root':-6.7, 'peek': 0.4},}

parameters_allied

Value:
{'neutral': {'mid':-3.0, 'root':-1.5, 'peek': 0.2,}, 'enemy': {'root':\
-8.0,},}