Ejemplo n.º 1
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))
Ejemplo n.º 2
0
def species_from_config(config):
    attributes = config['attributes']

    species = Species()
    species.name = config['name']
    species.life_span = attributes['life_span']
    species.monthly_food_consumption = attributes['monthly_food_consumption']
    species.monthly_water_consumption = attributes['monthly_water_consumption']
    species.minimum_temperature = attributes['minimum_temperature']
    species.maximum_temperature = attributes['maximum_temperature']
    species.gestation_months = attributes['gestation_period']
    species.minimum_breeding_age = attributes['minimum_breeding_age']

    return species