fireflies

A while back, I started a book called SYNC by Steven Strogatz. I didn't get very far. Not because it wasn't good, but because the early chapters gave me enough new ideas that I had to go off and start experimenting with them.

The relevant bit here is his discussion of certain species of fireflies, which appear to sync up their flashing by simple biological processes. Simple enough that it didn't seem like it would be too difficult to model them with a computer. Oh, and before we go any further, here's a video of the creatures in action.



What seems to be going on there is that each individual insect has an internal oscillator that is constantly building up a charge, until that charge passes a critical limit. That build-charge-release cycle always takes the same amount of time, except when the insect sees a neighbor flash. Then their internal charge builds slightly more than it would have normally. Eventually, this feeds back over a large and dense enough population and all of the individual insects will be flashing in unison.

The program I made to simulate this has four controls. At the default settings, sync is not inevitable. But if you nudge the sliders in small increments, eventually you'll get to the point where everything falls into place. The controls are as follows:

  • Fireflies: How many fireflies are in the population.
  • Vision Distance: How far each individual firefly can "see". (Click the "Show lines of sight" box to get a graphic representation.)
  • Charge increase per cycle: This is their default rate of flashing. The setting's mainly there to adjust for varrying computer speeds.
  • Charge increase per neighbor: How sensitive each firefly is to the activities of their neighbors.

This browser does not have a Java Plug-in.
Get the latest Java Plug-in here.

Source code: Sync_02_fireflies2

Built with Processing