Dylan’s Game of Life: A Mandala Generator Decoded



What does it mean to be alive? This has been a fundamental question since the first humans began asking questions at all. While many of our species have determined that an answer cannot be ascertained because of the shear ineffability of the gods, others of us have attempted to create simulacra of life itself. One such simulation, developed by mathematician John Conway in 1970, was popularly named the Game of Life.

What you see at the top of this post is a variation on Conway’s Game of Life, henceforth abbreviated as Life, developed by my friend Dylan Lovinger. Dylan is a sixth year Ph.D. student in Physics at UCSD with a research focus in Condensed Matter and Optical Spectroscopy. Mostly he plays with lasers (for science of course). But Dylan has always been interested in “the union of art, science, and math” and decided that it might be useful and fun for him to learn some creative coding. That is how he came upon the concept of cellular automata.

A cellular automaton is a set of rules that governs a system of neighboring cells over a series of generations. Cells can be turned on or off each cycle depending on how many neighbors they have. Mathematicians first began playing with these systems in the early 1900s on two dimensional grids with tiles, much like a Go set. The rules were very simple and as follows:

  1. If a cell has fewer than two neighbors, it turns.
  2. If a cell has more than three neighbors, it turns off.
  3. If a cell has two or three neighbors, it stays on.
  4. If a cell that is off has exactly three neighbors, it turns on.

Life is thusly named because the system it creates is self-reproducing in a way that can create novelty on its own. In particular, the patterns that emerge depend solely on the initial input on the grid—the system then begins propagating on its own.

Dylan calls his cellular automaton a “mandala generator” because of the design it makes. To add complexity to his system, he created an additional set of rules that determines the color of the cell depending on how many secondary neighbors it has. By starting with a radially symmetric initial input, Dylan is able to make the system propagate with the same symmetry.

He encountered a couple of problems designing his program. First, some of the cells would get stuck in a certain pattern, called a still life. Second, it was often hard to get the design to grow. To fix this, he added some lines of code that prevented “stuck” scenarios, and then changed the base rules from three neighbors turns a cell on, to six, seven, or eight neighbors turns a cell on. By repeatedly tinkering with little details like this, Dylan was able to produce the program you see before you.

Moving forward, Dylan sees this project as pretty much done. “My goal was to learn how to program better. I’m a physicist. We don’t learn how to program as much as we should.” But this exercise has inspired him to take on new projects that bring an artistic perspective to physics concepts—like chaos pendulums, particles in a box, and other wave simulations.

Dylan’s advice to others who might want to make cellular automata of their own is to just start coding. He uses a language called Processing and learned it through tutorials from The Coding Train by Daniel Shiffman. He has even shared his source code here. From there it is just a matter of finding something that is fun and interesting to you.

One thought on “Dylan’s Game of Life: A Mandala Generator Decoded

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s