I’ve been on a widget building kick lately. My most recent widget is a toy that lets you adjust the way a grid of simulated fireflies interact with each other. (You can download the toy by clicking on the image to the right. But you’ll need to get the Yahoo Widgets 4 engine first if you’ve never used a widget before.)
I’ve built various versions of this thing over the years, starting with programs I wrote in BASIC on the Apple II PCs in my high school programming class, to hardware fireflies made of LEDs and TTL chips in my college lab (I was supposed to be doing experiments for my electricity and magnetism lab, but I got distracted), to Pascal, Fortran and Visual C++ programs – and finally a widget.
These days, things like this are described as examples of the emergence of complexity in systems of simple objects. I didn’t know that when I made my first one, but I was intrigued to find the pretty patterns that formed all by themselves when I gave the simulated fireflies a few rules to help them decide when to flash.
In this widget, fireflies live on a 25 by 25 grid. They each have an internal timer that tells them how long to wait between flashes.
Interesting things can happen when you instruct them to pay attention to their nearest neighbors and change the timing of their next flash based on what’s going on nearby.
To make a firefly want to flash at the same time as those around it, you turn up the coupling between fireflies. If you want them to avoid flashing along with their neighbors, you can turn the coupling down until it’s negative.
You can also add some randomness to the timing (with the ‘random noise’ setting), or change the period that fireflies wait between flashing with the ‘flash period’ controls.
There are a few other controls to fiddle with. The rest of the instructions are on my other blog, The Dark Net.
I built the widget version of this toy in part for my own amusement, and in part as a present for all the people who have signed up to read my online science fiction novel. I’m also hoping it will keep them from getting bored waiting for the next chapter to come along.
Have fun.
-Buzz