Paper Wasps on the nest.

It was an ordinary, but small, Paper Wasp nest. Construction of the nest had begun only a week or two prior. At any given time there would never be more than three adult wasps present. The nest had about a dozen cells—with only six containing growing larvae. The other cells were either empty or contained a tiny white egg.

The wasp’s nest was hung from a light fixture located on the ceiling of a covered patio. I was present and sitting nearby when the nest was doused with wasp spray. I observed with interest as the insect-sized drama that followed played itself out. A tragedy in miniature, by all rights.

The poisonous spray killed two of the adults outright, and they tumbled to the ground. The third adult wasp somehow avoided the worse of the toxic attack, and was observed beating a hasty retreat. Within a minute or so, the six larvae began dropping from the nest, following their parents to the ground. They were dead as well. It all happened very quickly.

Several minutes passed. The perfumed smell of the bug spray still lingered in the air as the lone surviving wasp finally made her way back to the general vicinity of the nest. Her drive to continue caring for her offspring, temporarily overriding her flight response.

As I watched, this wasp was repeated repulsed from the nest by the persistent toxicity that remained. It was not difficult to feel empathy for her plight. For many creatures, their investment in the next generation is all-important. It was no different for this wasp. Her instincts made her duty bound and determined.

It is surely a stretch to assume this wasp was feeling something closely akin to what a person might feel given the loss of their home and family. But the wasp’s behaviors were basic and purposeful—Her responses must be the distant relatives to the emotions that motivate us.

Before long, I began to notice that the that the wasp’s approach to addressing this situation was repetitive in nature. Algorithmic. It was almost like the wasp was running some kind of diagnostic/trouble-shooting subroutine. The computer programmer in me couldn’t help but wonder if the algorithms were simple enough to be discoverable, and I started taking notes.

Paper Wasps are only about and inch long. Very small in the scheme of things. Their heads are about the size of a mini chocolate chip. But, you only have to consider their behaviors for a short time before you will begin to notice clues that there must be a lot of processing power built into the nervous system of these diminutive creatures.

Many wasp abilities are very complex in nature. Maneuvering in a complicated three-dimensional environment, geo-locating and precise navigation, pulp creation and nest building, environmental chemical analysis, visual stimulus processing, and caring for their young are just a few examples of the technically challenging feats ordinary Paper Wasps are capable of. It’s all very impressive if you think about it.

In this case, I couldn’t help but wonder about the algorithms that were driving this insect as it responded to the attack on its nest. Would it be difficult to identify and codify a set of computer program-type instructions that would describe her behaviors?

I decided to give it a try. My results can be found below written in what we call pseudo code in industry parlance. I’ve also included a couple of flowcharts to capture a broader range of behaviors and how they relate to each other. Admittedly, these subroutines gloss over some of the most sophisticated processing being done by the wasp—Maneuvering in a complicated 3D environment, navigating and geo-locating, chemical analyses, etc are abilities that likely all require very complicated subroutines. Examining that level of complexity is beyond the scope of this article.

When the wasp first returned to the patio, she flew directly to the nest, demonstrating clearly that she knew exactly where it was. Her first approach was bold, but the wasp was strongly repulsed, at close proximity to the nest, due to the lingering wasp spray residue.

Her response to this chemical repulsion was to retreat a small distance, and then attempt to approach again from a slightly different direction. Over and over the wasp would try again, always with the same disappointing results.

Algorithm for approaching a toxic nest site.

After a handful of failures, the Wasp would suddenly change tactics. In a state of what could be perceived as frustration, the wasp would turn and fly far away from the nest. At these times, she would be away from the immediate vicinity for an extended period of time. It was almost as if the wasp was using these breaks as a way to regroup and recharge her determination.

An algorithm for taking a break and regrouping.

On other occasions the wasp would seem to acknowledge the futility of her mission. At these times, she changed tactics again, as if recognizing the possibility she might be confused. For a short time she would abandon her attempts to approach the actual nest site, and fly over to identical light fixture just a few feet away. She would examine and investigate this fixture carefully, before giving up and returning to the actual nest site once again.

Algorithm for dealing with confusion and exploring an alternative nest location.

Below are a couple of flowcharts I put together to try and tie all these behaviors together. The first one describes a possible algorithm the wasp could use to address the nest being disturbed—by an animal predator or something more indeterminate, like wasp spray. Let’s call this one the Nest Disturbance Routine… When this set of instructions is executed to conclusion, the flowchart then directs you to the next set of subroutines described in the second flowchart.

The Nest Disturbance subroutine. Click to Enlarge…

The second flowchart describes how the wasp might approach returning to the nest after a disturbance has settled down. We’ll call this one the Return to Nest Routine

The Return to Nest subroutine. Click to Enlarge…

Reportedly, the wasp continued returning to the nest and cycling through these futile behavior patterns for a full four days after the nest was sprayed. Ultimately, this little drama surely ended in the death of the sole remaining wasp. She likely continued executing these same behaviors over and over until exhausted or until she had accumulated enough of the wasp spray toxin for it to become disorienting and lethal.

One Reply to “A Computer Programmer Considers Insect Behavior”

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.