Skip to content

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

Notifications You must be signed in to change notification settings

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

No packages published

Languages