Skip to content

redmojo7/Swamp_Life_Simulation

Repository files navigation

Swamp Life Simulation

Preview

Here's a preview of what the app looks like:

JustTweet Screenshot

Contents

  • border.py - Boundaries: Stop the beings going beyond the grid(window).
  • config.py - Configration file initialize windows size and number of creatures.
  • grid.py - Move creatures(update cells), add new creatures and remove died creartures.
  • map.py - The map of this simulation, which include mountains position and all alive creatures.
  • swamp.py - Definition of class Creature, Duck, Newt and Shrimp.
  • grass.py - To reproduce soome grass(food).
  • main.py - Entry point, the main function of Simulation.
  • simulation.py - Show simulation info on screen, store app states for each step, and resume simulation from a CSV file.
  • terrain.py - Initial terrain for the map, and draw terrain on the screen.
  • tools.py - Some tools function, such as manhattan_distance().

Test

  • SwampTest.py - Unit test for swamp.py.
  • ToolsTest.py - Unit test for tools.py.
  • TestInteractWithFood.py - Integration test for interactions (tracking or fleet).

Others

  • png - Image directory.
  • config - Configuration directory.
  • output - Output directory, which be used to store application states and resume app from CSV file.

Dependencies

  • python3-pygame
  • python-math
  • numpy

Version information

24 Sep 2022 - Initial version of Swamp Life Simulation.

How to run the program

Install imported libraries(python3-pygame,python-math,numpy)

sudo apt-get install python3-pygame
pip install python-math
pip install numpy
pip install pyyaml

Start it by Running:

python3 main.py

About

Swamp Life Simulation with Python

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages