Tribute to Craig Reynolds' classic artificial life program created with the pygame library
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


This artificial life program simulates the flocking behavior of animals. Using the pygame, math, and random libraries, an object is created (a bat in this case) that will be attracted to the other objects in the sim. As they fly around, they eventually maintain a minimum distance between each other and approach their neighbors' velocities until they all reach a regulated velocity. The user can interact with the simulation by clicking to generate more bats.

There are three editable constants: ECCENTRICITY, CONFORMITY, and SHYNESS (modifiable in which control the behavior of the animals. The degree of random fluctuation in the bats' movements is the eccentricity factor. The shyness is how inclined the bats are to repel their neighbors, while conformity is the factor that determines their tendency to change their velocity to gather and align with the bats around them.

Inspiration: Boids - Wikipedia, the free encyclopedia

Getting Started

pip install -r requirements.txt

Press the spacebar to ready the simulation, and again to start it. Click to place boids.