def talk(self): if self.agent_activity != AgentActivityState.NONE: return talkable_agents = WorldSearcher.get_nearby_talkable_agents( self.field, self) if len(talkable_agents) == 0 \ or not is_with_probability(SimulationConfig.talk_probability): return self.agent_activity = AgentActivityState.TALK action_duration = get_value_with_variation( SimulationConfig.talk_duration, SimulationConfig.talk_duration_variation) mate = rand_from_set(talkable_agents) if mate.agent_activity != AgentActivityState.TALK: mate.agent_activity = AgentActivityState.TALK elif mate.action_duration < action_duration: action_duration = (mate.action_duration + action_duration) / 2 mate.action_duration = action_duration self.action_duration = action_duration self.infection_probability_factor = SimulationConfig.talk_infection_probability_factor
def calculate_symptoms_probability(): return get_value_with_variation( SimulationConfig.has_symptoms_probability, SimulationConfig.has_symptoms_probability_variation )
def calculate_sneeze_probability(): return get_value_with_variation( SimulationConfig.sneeze_probability, SimulationConfig.sneeze_probability_variation )
def calculate_cough_probability(): return get_value_with_variation( SimulationConfig.cough_probability, SimulationConfig.cough_probability_variation )
def calculate_sickness_duration(): return get_value_with_variation( SimulationConfig.sickness_duration, SimulationConfig.sickness_duration_variation, True )
def calculate_recovered_duration(): return get_value_with_variation( SimulationConfig.recovered_duration, SimulationConfig.recovered_duration_variation, True )
def calculate_infection_duration(): return get_value_with_variation( SimulationConfig.infection_duration, SimulationConfig.infection_duration_variation, True )
def calculate_resistance(): return get_value_with_variation( SimulationConfig.agent_resistance, SimulationConfig.agent_resistance_variation )
def calculate_infection_probability(): return get_value_with_variation( SimulationConfig.infection_probability, SimulationConfig.infection_probability_variation )