Ejemplo n.º 1
0
def get_initial_simulation_step():
    male = Animal()
    male.gender = GENDER_MALE

    female = Animal()
    female.gender = GENDER_FEMALE

    simulation_step = SimulationStep()
    simulation_step.animals.append(male)
    simulation_step.animals.append(female)
    return simulation_step
Ejemplo n.º 2
0
def get_new_animals_from_breeding(count, month):
    for female in range(count):
        gender = get_new_animal_gender()

        born_animal = Animal()
        born_animal.birth_month = month
        born_animal.last_feed_month = month - 1
        born_animal.gender = gender

        yield born_animal
Ejemplo n.º 3
0
    def test_finish_breeding(self):
        simulation_step = SimulationStep()

        animal = Animal()
        animal.gender = GENDER_FEMALE
        animal.gestation_months = 1

        species = Species()
        species.gestation_months = 1

        new_animals = tuple(breed_animals([animal], species, simulation_step))
        self.assertEqual(0, animal.gestation_months)
        self.assertEqual(1, len(new_animals))