LifeImg

A glider gun, with cell decay rendered linearly (50 iterations).

About

Business cards

This was written to produce images for the reverse of my business cards — each one has a single image representing one iteration of a the game of life. Most tools to run the cellular automata seem to make exporting images tricky, so I wrote this.

Computation of the automata is very naïve, simply iterating through cells and computing the rules one by one. This system was never designed to be quick, nor to compute huge patterns, but it is quite suited to producing a series of images, so might still be handy. The code is also pretty simple, if anyone wants to learn Ruby

Requires rmagick, which it uses to generate the image.

Download

Download lifeimg.tar.gz.

Usage

A handy guide can be found by running the tool without any arguments. This will output the following:

$ ruby lifeimg.rb 
Conway GoL Image Creationistiser

USAGE:
  ./lifeimg ITERATIONS WIDTHxHEIGHT INFILE OUTDIR [GRADLEVEL]

ITERATIONS      : Number of images to output
WIDTHxHEIGHT    : Dimensions of the image, ie '1024x768'
INFILE          : Input file, in gol format (see below or example)
OUTDIR          : Output directory
GRADLEVEL       : Levels of gradient fill to use, 1 for on/off black/white


GoL Input File Format
---------------------
Line 1: GWIDTHxGHEIGHT
Line 2: (newline, no content)
Line 3: (row 1, space/. coded)
Line 4: (row 2...)

GWIDTHxGHEIGHT  : Dimensions of grid to simulate.
space/. coding  : Each character is a cell.  Use a space to  denote no cell,
                  or any non-space character to indicate a cell.  Cell 1,1
                  will be placed at the top left, so there is no need to
                  type out all lines in a grid (phew!).

An example, used to create the picture at the top of this page (along with feh), is: ruby lifeimg.rb 50 640x480 glider.gol output/ 20