Simple Rules, Emergent Beauty, and Life; Artificial and Otherwise
A Love Letter To Conway’s Game Of Life
In 1948 legendary thinker, engineer, and mathematician John Von Neumann wrote a paper called “The General and Logical Theory of Automata”. The paper was inspired by the “continuously increasing” and “very considerable” role played by automata in the natural sciences. In this, and several subsequent lectures and papers, Von Neumann would describe humans as a series of “elementary units” (e.g. muscle, neurons, a metabolic system); complex as we are, ultimately we can be boiled down to a kind of self-reproducing assembly line. In the process, Von Neumann posed the question that would become the spark of Conway’s famous game:
Can one build an aggregate out of such elements in such a manner that if it is put into a reservoir, in which there float all these elements in large numbers, it will then begin to construct other aggregates, each of which will at the end turn out to be another automaton exactly like the original one?
Von Neumann wanted to prove that we could invent mechanical life. Could machines reproduce themselves the way plants, animals, and/or bacteria do?
By this time, much of the fundamentals of DNA had been discovered. Scientists of the day knew about mitosis, some of the structure of DNA (including the GATC nucleotides we all know and love) and in 1953 James Watson and Francis Crick would make a groundbreaking discovery: the “double helix” structure of DNA.
Applying a programmer’s perspective to DNA, it’s easy to see how Von Neumann might think that a computer program could mimic the functions of life.
DNA as a Programming Language
DNA can be thought of as a long series values, with only four choices for each value. To me, DNA is highly reminiscent of binary; but instead of 0 and 1, DNA has A, T, C, and G. Even more striking is how DNA is used in our genes. Just like the binary data that comprises a computer program, our DNA contains instructions for our bodies.
The ordering of the nucleotides (ATCGs) controls when cellular organisms produce proteins, and which proteins are created. This a process is called protein synthesis. DNA provides the template for building proteins — sections of DNA that contain such templates are called “coding” DNA; sections that do not play a role in protein synthesis are called “non-coding” DNA. All of your genes are “coding DNA”. Surprisingly, coding DNA only makes up about 2% of the human genome.
These coding sections of DNA encode the series of amino acids that must be used to create a protein. This is done through the use of codons — which are nucleotide triplets. Most codons map to a single amino acid, the exceptions are start and stop codons, which indicate the beginning or end of a protein sequence.
The codons are copied from a DNA strand by an enzyme called an RNA polymerase. The RNA polymerase (with the help of other cell proteins called “transcription factors”) produces a strand of RNA which is essentially a copy of one-side of the DNA’s double helix. This strand of RNA, called Messenger RNA (mRNA) is brought to a ribosome. The ribosome reads the instructions on the mRNA, codon by codon, to produce a protein.
Proteins do just about everything at a cellular level. Antibodies that protect you from disease are proteins. Enzymes that break down and process chemicals are proteins. Muscles and other structural elements of bodies and plants are proteins. In a kind of strange loop, the instructions for creating the RNA polymerase and the ribosome — both of which help to process the information stored in DNA— are also stored inside of DNA. This kind of self referential behavior reminds me of compilers and virtual machines; computer programs designed to read, write, and execute other computer programs.
Boiling down something as complex as life to a long chain of discrete values is quite appealing to a programmers mind, even if we recognize that it’s a huge oversimplification. In this model, a bunch of individual things (cells, transcription factors, etc.) are following pre-written rules (DNA) for producing specialized tools (proteins) to carry out the tasks of life, including the task of self-reproduction.
If a cells behavior is largely defined by its proteins; and the rules for creating proteins are defined by its DNA; and DNA is just a prewritten set of discrete values; why shouldn’t we be able to recreate a kind of mechanical life using a set of discrete values? In fact, if you zoom in a lot and squint your eyes, our bodies actually look a lot like the “reservoir” of individual parts that Von Neumann described.
This is the origin a field of study called cellular automata. The central idea is that simple cells follow predefined rules in a finite world. Although most cellular automata are vastly simpler than life on Earth, they are strongly inspired by biological life.
In 1952 Von Neumann completed a description of a self reproducing “cellular automaton”. After that, though, Von Neumann turned his focus elsewhere. His 1952 description would not be published until after his death in 1957. Years later, in 1969, Arthur Burks would take Von Neumann’s description across the finish line, and the next year John Conway would create the most famous cellular automata of all time.
Conway’s Game Of Life
In 1970, John Conway invented a cellular automaton that came to be known as “Conway’s Game Of Life”. Inspired by the work of Von Neumann, Burks, and other researchers, Conway sought to take the ideas of cellular automation and create a much simpler automaton.
Von Neumann’s automaton was enormous: each cell could be in one of 29 states at any time, and each state had unique rules. Burks’ final draft of Neumann’s machine was 133 pages of writing, diagrams, and references. Conway’s game is beautifully simple by contrast. Conway’s Game has 2 states, alive and dead. Here are all of the rules of Conway’s Game:
- The world is a 2D grid, like graph paper.
- Each cell in the grid is always “alive” or “dead”.
- Time advances as a series of discrete rounds.
Living cells follow 3 rules, each round:
- If fewer than 2 of your neighbors are alive, you die. (underpopulation)
- If more than 3 of your neighbors are alive, you die (overpopulation)
- Otherwise (if you have 2 or 3 neighbors) you survive.
Dead cells have 2 rules, each round:
- If exactly 3 of your neighbors are alive, you become alive. (reproduction)
- Otherwise you remain dead.
Because of it’s simplicity Conway’s automaton was able to come to life, in digital form, even on the computers of the 1970’s. Even though the rules are simple, some incredible patterns emerged. You can see for yourself, here (click and drag to add life forms).
The patterns are obviously not as complex as those we find in nature, but I’m always surprised that such a simple setup can yield such complexity; and this actually surprised Conway as well.
Conway was actively engaged in research about automata. At the time he was exploring the limits and behavior of such systems. Initially, he proposed that no pattern in his simulated “Game of Life” could grow without limit; he reasoned that a finite world with finite rules could not produce an infinite amount of life. As a wonderful example of early crowdsourcing Conway used the Scientific American column Mathematical Games, to promise $50 to anyone who could disprove the conjecture within a year. The crowd sourcing worked. Within a month William Gosper and a team at MIT had sent Conway the pattern for the “Glider Gun”, which endlessly generates gliders that sail to the edges of the grid.
Between 1970 and 1980 many interesting patterns were found, including minimal patterns that include only 10 initial live cells, but that reproduce endlessly; so called “rakes” and “puffers” which fly across the grid, leaving behind “gliders” and “spaceships”, which then fly across the screen themselves.
By 1980, Conway had collected enough patterns to prove that The Game Of Life could be used to create a “Turing machine”, and was in fact “Turing complete”. This means, essentially, that any program we could run on our computer can be represented as an initial state in Conway’s Game of Life. This incredible fact has been put to the test. In the year 2000 Paul Rendell created a Turing machine using the game.
Lots of other surprising things have been found to be Turing complete. For example the x86 instruction mov is Turing complete. The mechanics of Minecraft are also Turing complete. Oftentimes, even a simple set of rules can result in extraordinary and complex interactions. Minecraft, mov, Conway’s Game of Life, and DNA all exhibit this phenomenon, called “emergent behavior”.
Artificial Life, Real Life, and Emergent Behavior
For something to have emergent behavior, the system as a whole must have properties that are not described by the individual components of the system. For example, Conway’s rules do not define “gliders” or “glider guns”; and he certainly didn’t set out to create a Turing machine. But, by defining a simple set of rules, he created a system that had these characteristics; these are emergent properties of Conway’s Game.
Emergent properties are all around us: the fact that snowflakes form fractal patterns is an emergent property of water and the physical laws governing temperature and water molecules. Thoughts appear to be an emergent property of electrical signals and neurons. Indeed biological life can be seen as an emergent property of the chemical and physical properties that govern our universe; spurred by the specific conditions here on Earth, which is itself an emergent property of the laws of astrophysics.
Some of the most incredible aspects of life appear to be emergent properties of otherwise simple rules. Consider the ant, one of Earth’s most successful species. Every experiment we’ve done seems to confirm that individual ants follow simple rules that govern their behavior; they take input from the world around them (mostly chemical, but also light and touch) and seem to respond to those signals according to simple rules.
Sometimes their simplicity leads them to ruin, as in the “Death Spiral” phenomenon, where army ants get trapped in a circular pattern of pheromones and walk in a circle, until their death.
While running in circles endlessly until you die isn’t exactly a sign of sophistication, ants have also managed some remarkable and complex tasks. Ant’s have:
- Created massive structures, as big as 670 acres.
- Engaged in husbandry by raising aphids.
- Engaged in farming by growing mushrooms.
- And (my favorite) independently invented portions of TCP & IP, which are important computer protocols that govern traffic on the Internet.
Even crazier, the rules that govern these behaviors are passed on through genetic data. The rules for constructing lifeforms, as encoded in our DNA, have exhibited the emergent property of becoming ants, humans, trees, and every other living thing over the course of billions of years.
In fact, all of biology may just be an emergent property of the rules of chemistry and physics; and while we have continuously grown our understanding of what those rules are, no one really knows why the rules of chemistry and physics are what they are. Maybe God spent 7 days tinkering before deciding on them; maybe we are just living in one of many simulations; maybe things just are, and there is no rhyme or reason for any of this; or maybe the answer is simply 42.
No one really knows, but we do know one thing…
Some Rules Work, Others Don’t
We’re on the only planet that we know of which contains life. How many planets actually contain life is, of course, an open question; but it’s clear that the conditions for life are somewhat fragile. The following are conjectures, but we have good reason to believe that for a planet to have life:
- There needs to be water.
- It can’t be too hot.
- It can’t be too cold.
- There has to be an atmosphere.
- The atmosphere needs some special chemical properties (e.g. a carbon cycle, a water cycle, enough oxygen, enough CO2…)
- And more.
I read somewhere that Conway originally fiddled around quite a lot before landing on the specific rules that became the Game of Life. I was curious about how fragile life was in the context of Conway’s 2D grid, and I was excited to tinker with the rules myself, so I took the simple Game of Life simulation I wrote and extended it so that I could easily modify the rules.
In my new version of The Game Of Life, living cells might:
- Die if they have fewer than some number of living neighbors (0–8).
- Die if they have more than some number of living neighbors (0–8).
- Survive otherwise.
And dead cells might:
- Become alive if they had between n and m living neighbors, where n and m are integers between 0–8, and m is always larger than n.
- Remain dead otherwise.
I then wrote a function that generated all 3,645 combinations of such rules, and wrote a new visualizer that randomly cycled through the rules and populated the grid randomly with a 20% chance of a cell starting “alive”. Finally, I programmed each individual grid to change colors when the rules changed, so that I could see when the rules were updated.
Because 3,645 combinations is a lot and I wanted to quickly gain some intuition about what percentage of rules created interesting patterns, I put 16 simulations on the screen at once. The result felt a little bit like a moving Andy Warhol painting.
Here is that simulation (epileptic seizure warning, there are lots of flashing lights). Here is a similar simulation that does not have changing colors, but does still flash between black and muted blue with frequency. And finally, here is a web-form that you can use to create similar pages with properties of your choosing.
While many rules create fascinating patterns, just as many result in the death of all cells, and a blank screen. Like the planets whose surfaces have been observed, when conditions aren’t quite right, nothing lifelike happens.
Playing God in Conway’s Editor
Not satisfied with my experiments so far — I decided to give myself more control over Conway’s world. Thus, “Conway’s Editor” was born. In the editor you can:
- change the rules,
- spawn life,
- pause and play the simulation,
- change the colors,
- And use the “toggle rule box mode” to create simulations that have different rules in different areas (sorry phone users, this feature only works on the computer for now).
I will leave you with a few examples that I created using the editor, then wrote custom code to generate. These simulations all combine different sets of rules into a single simulation, and they all have a small component of randomization; I hope you’ll enjoy them as much as I have enjoyed making them.
If you want to experiment even more, all the code for my version of Conway’s Game of Life is available on Github, and has been released to the public domain (without warranty of any kind). Please feel free to take it, and create a world of your own. If you just want to play around with Conway’s visit Teb’s Game of Life.