The Game of Life

  • Type "p" to generate a new pattern from among the classics.
  • Type "l" to generate a pattern of random lines.
  • Type "spacebar" to pause the animation. Type "spacebar" again to un-pause it.
  • Type "r" to reset the stage to its initial state.
  • Type "c" to clear the stage.
  • Type a number ("0" - "9") to refresh the stage with a percentage of randomly seeded cells. The result is a percentage of cells 10 times the typed number that start the animation alive ("0" = 0%, "3" = 30%, "9" = 90%). Future commands will execute with this percentage of additional seeds, until "r" resets the stage. There are initially 0 random seeds.
  • Type "t" to include the text area in the animation. Type "t" again to bring it back.
  • Draw with your mouse to toggle cell states. The animation pauses while your mouse is depressed and resumes upon release. Pause the animation ("spacebar") before drawing to enable multiple strokes.
  • Type the "enter/return" key to step to the next generation of a paused animation.

The Game of Life is a simple cellular automata "zero-player game" that evolves on its own based on surprisingly simple logic. It was devised by the mathematician James Conway. This version comes pre-populated with many classic patterns that lead to interesting results. It expands the game to include interactivity, allowing "players" to draw patterns of their own, and manipulate the game as it evolves.

I've shared the source code, and wrote it to be easily modified to explore its creative possibilities. It can serve as a great starting point for great generative design. Check back for updates and expansions. You can get it here: https://github.com/maniere/Game-of-Life.

To run the code, copy it into Processing version 3 or later, and play. The code is compiled into Java. To download the latest version of Processing: http://processing.org. The animation above was created by pairing a slightly modified version of the code with processing.js to display in a browser using JavaScript instead of Java.

The rules of the game of life are simple. Living cells persist into the next frame of the aminmation if 2 or 3 of the 8 cells that surround them (their neighbors) are also alive, otherwise they die. Dead cells come to life in the next frame of the animation exactly 3 of their neighbors are alive.

For more on the Game of Life, here's a good summary.

I have taught the Game of Life in Amit Pitaru's "Creating Code for Digital Media" course at the Pratt Institute's Graduate School of Design and I've presented it leading a workshop on generative design at the Interactive Telecommunications Program, New York University's Tisch School of the Arts. Generative and algorithmic design are interests of mine, generally.