Gliders over the US: Conway’s Game of Life with zip codes

Tom Grek
4 min readApr 22, 2018

--

It’d be really interesting to model the success and failure over time of US zip codes. I’ve been thinking about how to use multi-agent simulation to model how population groups evolve over time.

This weekend, instead of doing that, I decided to make something pretty instead: if each zip code could be ‘alive’ or ‘dead’, how would the US evolve?. There are about 33,000 zip codes in the United States, my majestic (and really, ridiculously large) adoptive home. That makes an interesting grid for Conway’s Game of Life.

Here’s how the grid looks:

Hawaii, Alaska and Puerto Rico are indeed simulated, but hard to screen capture. Sorry!

And here’s a bit of how it evolves when it’s alive:

Not much insight except that Oregon and Nevada’s zip codes are really large and empty

If you’re reading this, you’re probably somewhat familiar with the Game of Life. In case you need a refresher:

  • Begin with a grid of cells and a (random) initial state, in which some of the cells are alive and some dead.
  • Between one generation or epoch and the next, cells may die, remain alive, or come to life, depending on their surroundings.

John Conway’s rules are:

  • Cells with less than two neighbors, die
  • Cells with two or three neighbors, stay alive
  • Dead cells with three live neighbors, are born
  • Cells with more than three neighbors, die

This is known as ‘artificial life’, cellular automata, or just a great demonstration of complexity theory. For me, Melanie Mitchell’s 1992 book Complexity: The emerging science at the edge of order and chaos, and the depictions of the Santa Fe Institute’s crazy characters therein, especially Chris Langton, form a big part of why I am where I am today.

Regularly, Conway’s Game of Life is built out on a regular grid and its evolution over time looks something like this:

This GIF from Wikipedia, originally captured by Karl Bednarik

Patterns form and replicate themselves. Some configurations of pixels/cells remain stable. Sometimes the whole system dies out to nothing; sometimes a self-sustaining ecosystem emerges. People get really involved with the Game of Life, and why not: it is after all a Turing-complete system, meaning that (given a set of initial conditions) it can simulate any other system.

I used Javascript, Atlas by SAP, and MapboxGL to make the Game of Life with zip codes. Here’s an example with the original rules:

Though zip code shapes make it difficult to see ‘cellular’ automata — sadly, I couldn’t make out any gliders — I did happen to spot a toad in Alaska:

I didn’t know until writing this article, just how huge Alaska really is. It’s massive!

The original rules were designed for cells that have 8 neighbors, i.e. at the center of a 3x3 square. The median zip code has slightly more neighbors than that, so I boosted Conway’s numbers up by one, and the grid evolved to a (more-or-less) steady state:

The United States’ most “stable” zip codes

Modeling geographic regions as autonomous agents has much promise, I think, but this was only a fun, short project.

In Atlas, where I work, we have a ton of data about zip codes and other geographic levels. After proving out the concept, I’d like to apply our data to these automata: such as, a cell (zip code) only stays alive if its real-human-population, and that of its neighbors, meets a certain minimum.

Please, let me know if you have ideas in this space!

The source code is available here, but it relies on a JSON file listing zip codes and their adjoining zip codes which I obtained from Atlas and can’t provide here. (You can, however, generate it yourself with judicious use of PostGIS and US Geographic Survey files).

--

--

Tom Grek

Engineer in the NLP/AI space. Maker, hacker, MS EE. AGI enthusiast. Traveler and nature lover. Opinions are my own.