Boids flocking simulation in the terminal, in C.
A small, self-contained demo written in pure C — no external libraries, just the standard library and POSIX. Part of the Corg-Labs collection of single-file C programs.
- Each agent looks at neighbours within a radius
- Three rules apply: separation, alignment and cohesion
- Speed is clamped so the flock moves coherently
- Direction is drawn as an arrow glyph
gcc boids.c -o boids -lm
./boids
Press Ctrl-C to quit.