Agent-based modeling in JavaScript in the browser or on the server. [v0.4.8]

Fireflies Syncing

This model, based on observations of fireflies in Thailand, shows how a system of distributed entities with periodic behavior can eventually become nearly perfectly in sync. Each ‘firefly’ agent has an internal clock, and when it flashes, nearby fireflies accelerate their clocks forward slightly. As the fireflies randomly navigate the environment, they encounter more and more flashing fireflies and grow more in sync with them. After a relatively short amount of time, all the fireflies are flashing in unison, with no top-down or centralized behavior organizing them. Like in the flocking model, this behavior emerges out of the interactions of many individual agents.

The implementation of this model is indebted to Nicky Case’s interactive explorable “Fireflies”, and the phenomenon is described in the opening chapter of Steven Strogatz’s book Sync: How Order Emerges from Chaos in the Universe, Nature, and Daily Life.