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.
- 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.
- 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.
Clone the repository and run the simulation script:
git clone
python simulation.py
'''.##'''