def _check_interaction(sick_person: DefaultPerson, healthy_person: DefaultPerson): if sick_person is not healthy_person and sick_person.is_contacting( healthy_person): sick_person.interact(healthy_person) return healthy_person
def _create_sick_person(self, symptomatic=True): person = DefaultPerson(home_position=self._position, virus=self._get_infection()) _ = person.set_state(SymptomaticSick(person)) if symptomatic \ else person.set_state(AsymptomaticSick(person)) return person
def setUp(self): age = 40 weight = 80 self._sick_person_flu = DefaultPerson( age=age, weight=weight, virus=SeasonalFluVirus(strength=1.0)) self._sick_person_cholera = DefaultPerson(age=age, weight=weight, virus=Cholera(strength=1.0))
def simulation_person(person: DefaultPerson, days: int = 10, flu=True): characteristics = [] for day in range(days): person.day_actions() person.night_actions() day_num = day temperature = person.temperature water = person.water current_value = temperature if flu else water characteristics.append(current_value) return characteristics
def create_persons(min_j, max_j, min_i, max_i, n_persons): min_age, max_age = 1, 90 min_weight, max_weight = 30, 120 persons = [ DefaultPerson( home_position=(randint(min_j, max_j), randint(min_i, max_i)), age=randint(min_age, max_age), weight=randint(min_weight, max_weight), ) for i in range(n_persons) ] return persons
def _create_healthy_person(self, default_position=True): return DefaultPerson(home_position=self._position) if default_position \ else DefaultPerson(home_position=(0, 1))
def _create_person_with_antibodies(self, antibodies_type): person = DefaultPerson(home_position=self._position, ) person.antibody_types.add(antibodies_type) return person