Skip to content

Agent-Based Modelling: Sheep grazing, reproducing, dying. Python Tkinter GUI.

License

Notifications You must be signed in to change notification settings

amiraliemami/SheepSim

Repository files navigation

Sheep Sim (°ꈊ°)

Submission for Assessment 1 of GEOG5995 at the University of Leeds

Website

https://amiraliemami.github.io/SheepSim

Workbook

Practicals 1 to 9 are presented in a Jupyter Notebook, included in the repository and also hosted here. This is also linked to in the website.

Model and GUI

The final model and extras are presented by model.py, using agentframework.py for definition of the agents and their attributes and methods.

To run the model and load the GUI, run the following:

python model.py

Extra features

  1. Death - sheep die after reaching maximum life expectancy (adjustable in GUI, default 60)
  2. Size is relative to age, maximum reached at death
  3. Optimised movement - move to position which has most grass, instead of random
  4. Seeding for spawning - random or set, allowing repeated experiments
  5. Sexes and Reproduction - female sheep (white) can be impregnated by male sheep (black) if both sheep have sufficient store (default 50), are close enough (default within 20), and are of fertility age (adjustable in GUI, default 20)
  6. Pregnancy takes time - female sheep get pregnant, and after a number of turns (adjustable in GUI, default 10), give birth to a new sheep nearby.
  7. Defaults button - reset all values to default
  8. Start/Kill/Restart button - can stop and restart simulation (even with changed parameters) without having to rerun the script.

UML Diagram

Testing

To run the unit tests, simply run the following script:

python tests.py

Other tests that were run during the development process:

  1. Made sure that slider values are passed into the run function in model.py as expected.
  2. Fixed frame number edge-cases to make sure first frame was spawn, then move and eat and mate were in the correct order
  3. Whether there was need for randomisation of the agents list (as this was causing drawing flickers) - answer is no
  4. Made sure 'optimised movement' did not get stuck by addin random movement if this happens
  5. Type and value checking was added to the main python scripts and mistakes will be caught by them
  6. move(), eat(), and mate() were checked against their behaviours in the simulation

Documentation

The documentation for this simulation can be found below (also linked to in the website):

Docs

License

MIT

Website is based on the "514_magazee" template by templatemo - no license file was provided by them, but the following is from the template's description:

"You are allowed to download, edit and use this Magazee HTML CSS layout for your commercial or non-commercial sites".

About

Agent-Based Modelling: Sheep grazing, reproducing, dying. Python Tkinter GUI.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published