run_model module¶
An agent-based model demonstrating population dynamics of mating rabbits.
This file is intended to be the main script run from the command line.
-
run_model.
create_rabbits
(environment, num_of_rabbits, coordinates, lifespan)¶ Make new Rabbits, and return them in a list.
Parameters: - environment – A list of equal-length lists of integers representing quantities of grass in a field.
- num_of_rabbits – An integer specifying how many rabbits will be created.
- coordinates – A list of dicts including “x” and “y” values.
- lifespan –
An integer specifying at what age these new rabbits will die.
- Return:
- A list of Rabbits.
-
run_model.
my_timer
(process)¶ Decorator function to time the process.
-
run_model.
rabbits_interact
(rabbits, neighbourhood=10)¶ Shuffle the rabbits and then make them interact.
Parameters: - rabbits – List of Rabbits.
- neighbourhood – Integer representing distance at which Rabbits will mate.
-
run_model.
run_model
()¶
-
run_model.
save_data
(environment, rabbits)¶ Saves data generated by running the model.
Write environment to CSV file, and Agent data to text file, and test data to CSV file.
Parameters: - environment – A list of equal-length lists of integers representing quantities of grass in a field.
- rabbits – List of Rabbits.