conway's game of life

simple rules and emergent complex behavior

08-25-2024 / [interactive]

Image for conway's game of life

Generation: 0

How to use: Adjust the speed of generations with the slider. Select preconfigured origins or enter your own coordinates and press start. Works best on desktop.

Here's a quick limited implementation of Conway's Game of Life (for usability purposes, this grid isn't infinite). But it's mesmerizing nonetheless and still follows Conway's other original rules:

Each cell can be in one of two states: alive or dead. The fate of each cell is determined by the following, applied simultaneously to every cell in the grid at each step of the simulation:

  • Any live cell with two or three live neighbors survives
  • Any dead cell with exactly three live neighbors becomes a live cell, as if by reproduction
  • All other live cells die in the next generation, while all other dead cells stay dead

I made this with React so that I could run simulations in a sidetab while working on other things. It's fun to glance over to see how patterns are evolving over time, and then to change the initial conditions and let things generate and emerge again.

Cellular automata simulations are weird and beautiful. That may be part of why the Game of Life inspired work in everything from theoretical biology and chaotic systems to computer science and philosophy. If you're not familiar with the history, it's definitely worth exploring the Wiki:

Stanislaw Ulam, while working at the Los Alamos National Laboratory in the 1940s, studied the growth of crystals, using a simple lattice network as his model.[7] At the same time, John von Neumann, Ulam's colleague at Los Alamos, was working on the problem of self-replicating systems.[8]: 1  Von Neumann's initial design was founded upon the notion of one robot building another robot. This design is known as the kinematic model.[9][10] As he developed this design, von Neumann came to realize the great difficulty of building a self-replicating robot, and of the great cost in providing the robot with a "sea of parts" from which to build its replicant. Neumann wrote a paper entitled "The general and logical theory of automata" for the Hixon Symposium in 1948.[11] Ulam was the one who suggested using a discrete system for creating a reductionist model of self-replication.[8]: 3 [12]: xxix  Ulam and von Neumann created a method for calculating liquid motion in the late 1950s. The driving concept of the method was to consider a liquid as a group of discrete units and calculate the motion of each based on its neighbours' behaviours.[13]: 8  Thus was born the first system of cellular automata. Like Ulam's lattice network, von Neumann's cellular automata are two-dimensional, with his self-replicator implemented algorithmically. The result was a universal copier and constructor working within a cellular automaton with a small neighbourhood (only those cells that touch are neighbours; for von Neumann's cellular automata, only orthogonal cells), and with 29 states per cell. Von Neumann gave an existence proof that a particular pattern would make endless copies of itself within the given cellular universe by designing a 200,000 cell configuration that could do so. This design is known as the tessellation model, and is called a von Neumann universal constructor.[14]

Motivated by questions in mathematical logic and in part by work on simulation games by Ulam, among others, John Conway began doing experiments in 1968 with a variety of different two-dimensional cellular automaton rules. Conway's initial goal was to define an interesting and unpredictable cellular automaton.[3] According to Martin Gardner, Conway experimented with different rules, aiming for rules that would allow for patterns to "apparently" grow without limit, while keeping it difficult to prove that any given pattern would do so. Moreover, some "simple initial patterns" should "grow and change for a considerable period of time" before settling into a static configuration or a repeating loop.[1] Conway later wrote that the basic motivation for Life was to create a "universal" cellular automaton.[15][better source needed]

The game made its first public appearance in the October 1970 issue of Scientific American, in Martin Gardner's "Mathematical Games" column, which was based on personal conversations with Conway. Theoretically, the Game of Life has the power of a universal Turing machine: anything that can be computed algorithmically can be computed within the Game of Life.[16][2] Gardner wrote, "Because of Life's analogies with the rise, fall, and alterations of a society of living organisms, it belongs to a growing class of what are called 'simulation games' (games that resemble real-life processes)."[1] Since its publication, the Game of Life has attracted much interest because of the surprising ways in which the patterns can evolve. It provides an example of emergence and self-organization.[3] A version of Life that incorporates random fluctuations has been used in physics to study phase transitions and nonequilibrium dynamics.[17] The game can also serve as a didactic analogy, used to convey the somewhat counter-intuitive notion that design and organization can spontaneously emerge in the absence of a designer. For example, philosopher Daniel Dennett has used the analogy of the Game of Life "universe" extensively to illustrate the possible evolution of complex philosophical constructs, such as consciousness and free will, from the relatively simple set of deterministic physical laws which might govern our universe.[18][19][20]

The popularity of the Game of Life was helped by its coming into being at the same time as increasingly inexpensive computer access. The game could be run for hours on these machines, which would otherwise have remained unused at night. In this respect, it foreshadowed the later popularity of computer-generated fractals. For many, the Game of Life was simply a programming challenge: a fun way to use otherwise wasted CPU cycles. For some, however, the Game of Life had more philosophical connotations. It developed a cult following through the 1970s and beyond; current developments have gone so far as to create theoretic emulations of computer systems within the confines of a Game of Life board.[21][22]

More on Wikipedia

Anyway, I've included a number of patterns and phenomena that either stabilize, oscillate, or travel across the grid in the dropdown selector. Some well-known formations include:

  • Still Life: Stable structures that do not change from one generation to the next
  • Oscillators: Patterns that return to their original state after a set number of generations
  • Spaceships: Patterns that traverse the grid, maintaining their shape over iterations

My personal favorites here are Acorn and Diehard. You can also use the dropdown to set your own starting coordinates. There's something profound about watching simple rules and initial conditions create emergent complex behavior. Conway's Game of Life is also Turing Complete, which means that with the right initial configuration, it could theoretically perform any computation, one cell at a time over generations – try it out!

oakland