Boids

Boids is a swarm simulation, the birds follow these rules:

- Separation: steer to avoid crowding local flockmates

- Alignment: steer towards the average heading of local flockmates

- Cohesion: steer to move toward the average position of local flockmates

- Escape: steer away from the "eagle"

- Border constraints, here the position is just turned down

The calculation of the flock's position is done in two threads, the GUI is done via FLTK.

The birds move in 3D space, their depth is indicated via their brightness.

Compile it with (needs libfltk-dev):

$ g++ -O3 -Wall -funroll-loops -o boids boids.cpp -lfltk -lpthread

$ g++ -O3 -Wall -funroll-loops -o boids_3D boids_3D.cpp -lfltk -lpthread

Download the source here:

https://github.com/elsamuko/boids

qt-boids-2.tar.gz needs Qt, unzip the folder and run qmake, then make.

The dots are the birds, the big one is the eagle.