Visualizes the collective movement of agents (boids) following simple rules to mimic natural flocking behavior. Each boid follows three rules: separation (avoiding crowding neighbors), alignment (matching velocity with nearby boids), and cohesion (steering towards the group’s center). The simulation dynamically adjusts to changing environments, creating emergent, lifelike swarm behavior.
pip install -r requirements.txt
python ./src/main.py
- Press
wkey to move forward. - Press
dkey to steer clockwise. - Press
akey to steer counter-clockwise. - Press
SPACEkey to speed up. - Press
qkey to summon Boids.
e1
c0 _______ c1
| |
e0 | | e2
|_______|
c3 e3 c2