# wonder how many zombie film/tv/game creators are/were computer science nerds

As you all know, I am a huge zombie fan.

And, as you probably know, I was a CIS/CS major/minor at Elon.

A concept I was introduced to at both Shodor and Elon was ant colony simulations.

And I realized today that many people have been introduced to the basics concepts of ant colony simulations through films like {{Night of the Living Dead}} or {{World War Z}} and shows like {{Z Nation}} or {{The Walking Dead}}.

In short, {{ant colony optimization}} simulations, a part of {{swarm intelligence}}, use the “basic rules” of ant intelligence to game-out problems of traffic patterns, crowd control, logistics planning, and all kinds of other things.

Those basic rules the ants follow more or less come down to the following:

• pick a random direction to wander
• continue walking straight until you hit something
• if you hit a wall
• turn a random number of degrees between 1 and 359
• loop up one level
• if you hit food
• if you are carrying trash
• turn a random number of degrees between 1 and 179 or 181 and 359
• loop up two levels
• if you are carrying food
• drop it
• turn 180 degrees, loop up two levels
• if you are not carrying anything
• pick it up
• either turn 180 degrees and loop up two levels, or
• loop up two levels (ie, continue walking straight)
• if you hit trash (dead ants, etc)
• if you are carrying trash
• drop it
• turn 180 degrees, loop up two levels
• if you are carrying food
• turn a random number of degrees between 1 and 179 or 181 and 359
• loop up to levels
• if you are carrying nothing
• pick it up
• either turn 180 degree and loop up two levels, or
• loop up two levels (ie, continue walking straight)
• if you hit an ant
• a new ant spawns in a random cell next to the two existing ants (with a 1/grid-shape probability, in a square grid, this would be a ~10% chance of spawning a new ant; in a hex grid, it would be a ~12.5% chance of a spawn), IF there is an empty cell next to either ant
• if you are both carrying the same thing,
• start a new drop point
• turn around 180 degrees
• loop up two levels
• if you are carrying different things (or not carrying anything)
• turn a random number of degrees between 1 and 359
• loop up two levels
• if you have been alive “too long” (parameterizable), you die and become trash (dropping whatever you have “next” to you in a random grid point (for example, if the grid is square, you’re in position “5”, and your cargo could be in positions 1–4 or 6–9:

There are more rules you can add or modify (maybe weight your choice of direction to pick when you turn based on whether an ant has been there recently (ie simulated pheromone trails)), but those are the basics. With randomly-distributed “stuff” (food, walls, ants, trash, etc) on a board of size B, an ant population — P — of 10% * B, a generation frequency — F — of 9% * B, an iteration count of 5x board-size, a life span — L — of 10% * B, and let it run, you will see piles of trash, food, etc accumulate on the board.

They may accumulate differently on each run due to some of the random nature of the inputs, but they’ll accumulate. Showing how large numbers of relatively unintelligent things can do things that look intelligent to an outside observer.

And that’s how zombies appear in most pop culture depictions: they wander more-or-less aimlessly until attracted by something (sound, a food source (aka the living), fire, etc). And while they seem to exhibit mild group/swarm intelligence, it’s just that — an appearance to outside observers.

So if you like zombie stories, you might like computer science.

Originally published at antipaucity.

Show your support

Clapping shows how much you appreciated Warren Myers’s story.