# Stephanie Taylor # CS152 Fall 2017 # Project 5 # This module tests the newElephant function in elephant.py # Call it like this: # python test_newElephant.py # Because I have seeded the random number generator, the output will be identical every time you run it. You should see: # ['m', 9, 0, 0] # ['f', 46, 0, 0] # ['m', 27, 0, 0] # ['f', 48, 19, 0] # ['m', 26, 0, 0] # ['f', 1, 0, 0] # ['f', 44, 0, 0] # ['f', 55, 12, 0] # ['f', 57, 10, 0] # ['f', 2, 0, 0] # ['f', 27, 6, 0] # ['f', 14, 1, 0] # ['m', 51, 0, 0] # ['f', 39, 0, 0] # ['f', 52, 0, 0] # If you would like it to change from run to run, then comment out the call to random.seed. import elephant import random def main(): random.seed( 1 ) calving_interval = 3.1 pcnt_darted = 0.0 max_juvenile_age = 12 max_adult_age = 60 p_calf_survival = 0.85 p_adult_survival = 0.996 p_senior_survival = 0.2 carrying_capacity = 10000 params = [calving_interval, pcnt_darted, max_juvenile_age, max_adult_age, p_calf_survival, p_adult_survival, p_senior_survival, carrying_capacity] pop = [] for i in range(15): pop.append( elephant.newElephant( params, random.randint(1, params[elephant.IDXMaxAdultAge]) ) ) for e in pop: print e if __name__ == '__main__': main()