Discord
@eadan/firefly-synchronization
Simulation
1
0
Public

Firefly Synchronization

This model demonstrates how distributed agents may synchronize their actions without centralized decision making.

This model demonstrates how distributed agents may synchronize their actions without centralized decision making.

The model consists of fireflies randomly moving on a grid. Fireflies flash for one time step by turning yellow. The simple mechanism controlling their flashing behavior is:

  1. All fireflies have an internal clock with the same number of time steps. The length of this clock is controlled by the period parameter.

  2. Each firefly starts its clock at a random position.

  3. When its clock resets to zero, the firefly flashes.

  4. If a firefly sees a nearby firefly flash, it synchronizes its clock with that firefly.

Fireflies start off flashing erratically, but as the simulations progresses you will see clusters of fireflies flashing together. Eventually, one of these clusters dominates and all fireflies flash in synchrony.