Skip to content

alfredesan/Shark_and_school_of_fish_simulation_in_Python

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 

Repository files navigation

Shark and School of Fish Simulation 🦈🐟

This project simulates the interaction between a shark (predator) and a school of fish (prey) in a 2D environment.
It models schooling behavior, predator avoidance, and pursuit dynamics using numerical methods, visualization, and randomness.

Developed as part of the Master’s in Next-Level Engineering (MNLE) program.


🔹 Features

  • Realistic schooling fish dynamics (attraction, spacing, randomness).
  • Predator behavior with pursuit, attack radius, and eating latency.
  • 2D simulation with animated visualization of predator–prey interactions.
  • Adjustable parameters: fish count, shark speed, attraction strength, randomness, etc.

🔹 Tech Stack & Libraries

  • Python
  • Numerical & AI libraries: NumPy, Pandas, Torch
  • Visualization: Matplotlib, FuncAnimation, tqdm
  • Utilities: IPython.display (for inline animations in Jupyter Notebooks)

Example Output The animation shows: 🐟 Blue arrows → live fish schooling. ⚫ Black markers → dead fish. 🦈 Red/Orange arrows → shark (red = attacking, orange = searching)

Next Steps Extend to multiple sharks and multiple schools of fish. Explore emergent behaviors with varying parameters. Apply reinforcement learning for predator/prey strategy optimization.

🔹 How to Run

Clone the repository and run the simulation script:

git clone 
python simulation.py
'''.##'''

About

Shark and school of fish simulation(preditor and prey) in Python, this is a simulation project which is part of the MNLE program

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages