The Plague Algorithm

Introducing Disease to the Game of Life

R.Kieffer - July 8, 2004

Introduction

"Plague" is an exploration into the world of chaos and order associated with natural systems. By modeling basic properties such as infection, reproduction, and lifecycles, this algorithm provides insight into the behavior of self-stabilizing systems.

First developed as a way of modeling the effects of a virus on a contained population, Plague has proven to be a superb example of how a system with self-limiting behavior will respond to attempts to influence it. Any attempt to artificially control the system's behavior are invariably met by an adaption that negates whatever controls are put in place. The basic behavior tends to once again emerge and, more importantly, erupt violently in the opposite direction once the controls are removed.

It is left to the reader to decide if there are any social or political morals contained in this. You are encouraged to run the applet and decide for yourself.

The Plague UI

The Plague UI consists of the cell population - the kaleidoscope of colors that takes up the majority of the window - and some statistical information displayed along the top. The two white, horizontal bars represent the percentage of the population infected, and the average immunity of the population.  The immunity value is on 0-128 scale, indicating the average difference needed for one cell to infect a neighbor.

In the upper-right hand corner is a small chart of the relative populations of the different colors.

What You're Seeing

Each cell in Plague has four basic properties: a life span, a genetic code, an immunity level, and an infected state.  Only the genetic code and the infected state are displayed in this demonstration - the genetic code is indicated by the color - specifically, the hue - and the infected state is represented by showing the cells as either bright (uninfected) or dark (infected).

The "White Noise" phase

When the demonstration is first launched, each cell is initialized with a random color - it's "genetic code" - producing a pattern of "white noise". As cells "interbreed" with each other by sharing their genetic code (i.e. they combine their colors) the system will resolve itself into sub-communities that share similar color.

The "Infection" phase

As Plague runs, infections are being randomly dropped into the environment (implemented by randomly changing the color of a cell and setting it to "infected"). In the beginning, this has little to no effect on the system because each cell is initialized with an immunity of 127 - meaning it can't be infected.

However, one of the properties of Plague is that, without infection, the overall system immunity will decrease over time. As the average immunity drops, it will eventually reach a point where an infection can take hold and spread. Infections spread faster/easier between cells that have different colors. These infections, conversely, result in an increased immunity level.

Steady State or Chaos?

As mentioned previously, this system models itself loosely on the way viruses work.  The exact rules that are applied are listed in the next section.

The net effect of all this however, is that Plague works by pitting two forces against each other.  Cell reproduction is a stabilizing force that averages cell values, pushing individuals toward a community norm.  "Viral" infections on the other hand, result in rapid, chaotic change that influence large parts of the population in unpredictable ways.  In addition to these two forces, there is a third, hidden force - immunity.  As cells reproduce, their immunity level drops; as they become infected, it rises.  In other words, Plague is set up so that the stabilizing force (reproduction) makes the population more unstable in the long run while, conversely, the destabilizing force (infection) makes it more stable.

All of this can be observed as you watch Plague. The system slowly oscillates between periods of rapid activity and periods of calm.  This is caused by the immunity of the system rising and falling in response to the level of viral activity (or vice versa if you choose).

Plague is set up to encourage noticeable changes. The immunity concept encourages a virus of a particular color to spread to different colors rather than to similar colors (and, in fact, an infection will never spread to a nearly identical color).  Watch as infections spread into regions of new color;  in regions of dissimilar color the infections tend to spread quickly while in similar regions they will slow down and die out.  Don't be surprised, however, if you see an infection avoid, or progress slowly through a region of highly dissimilar color. This will happen in regions that were recently infected and that have an increased immunity level.

One final comment:  The plague demonstration employs a wrap-around technique to guarantee each cell has the same number of neighbors - all this means is that cells along the top of the matrix are neighbors with cells at the bottom and cells at the left are neighbors with cells on the right.  Infections will wrap from one side of the population to the other.

Rules of Plague

Dead cells are immediately replaced by new cells
This is done for simplicity.  In the real world, of course, viruses can and do kill off large communities which require time to repopulate.

New cells have their color and immunity set by averaging the corresponding values from two of their neighbors (chosen at random).
This is a basic bi-parental reproduction model and models the evolutionary behavior of passing traits from multiple parents to a single child.

New cells are uninfected
This is not necessarily the case in the real world, but does simplify the simulation.  Depending on the type of virus, children may or may not be infected at birth.

The immunity of new cells is reduced by a fixed amount.
If a population has not been exposed to a virus, or the virus mutates enough, the population will have little or no immunity to the virus.  This is simulated in Plague by averaging the immunities of the parents and then subtracting a fixed amount.

For each cycle, there is a 1 in 40 chance that one cell will mutate and become infected.
Viruses are introduced into populations more or less randomly.  Either the virus mutates from a harmless virus already in the host population or the virus crosses from one population into another.  An example of this is the recent Avian Flu scare in Hong Kong.

Cells are infected for life.
Medical science has never found a cure for a virus, only preventive measures, primarily in the form of vaccines.

Infected cells inherit 99% of  the infecting cell's color.
Viruses operate at the genetic level.  The very nature of a virus is that it changes the genetic structure of the organism it infects.  This mutating of DNA  is believed to be one of the forces that cause evolutionary change.

Infected cells are given maximal immunity.
Exposure to a virus increases the organism's resistance to the virus.  This is the basic principle on which vaccines are based.

The life span of a cell is chosen randomly.
Like most organisms, life span varies as a function of genetics and environment.

Requirements

This version of plague was compiled against the JavaSoft JDK 1.2-beta4.