1. Home
  2. LIFE procedure

LIFE procedure

Plays John Conway’s Game of Life (W. van den Berg).

Options

NROWS = scalar Number of rows in the grid (must greater than 5); default 51
NCOLUMNS = scalar Number of columns in the grid (must greater than 5); default 51
Y = variate Inputs the y-coordinates of the cells in the initial configuration
X = variate Inputs the x-coordinates of the cells in the initial configuration
NEWY = variate Saves the final y-coordinates
NEWX = variate Saves the final x-coordinates
NTIMES = scalar Number of times to update the configuration; default 200
TITLE = text Title for the plot
COLOURS = text or variate Colours for the live and dead cells; default !t(SpringGreen, Black)
PAUSE = scalar Time in seconds to pause before displaying the next plot; default 0.5

No parameters

Description

John Conway’s Game of Life is an example of cellular automation (Gardner 1970). Cells in a two-way grid are born or die according to their numbers of neighbouring cells. LIFE starts with an initial configuration of live cells, and follows its progress in a series of time steps in which cells are born or die, according to the following rules.

1) Any live cell with fewer than two live neighbours dies (exposure).

2) Any live cell with more than three live neighbours dies (overcrowding).

3) Any live cell with two or three live neighbours lives, unchanged, to the next generation.

4) Any dead cell with exactly three live neighbours will come to life (birth).

LIFE plots the grid after each step, so that you can see how the population is developing.

The number of rows and columns in the grid can be specified by the NROWS and NCOLUMNS options, with defaults of 51. The x- and y-coordinates of the initial configuration of live cells can be specified by the X and Y options. If these are not set, an initial configuration in the shape of an X is used. At least three neighbouring cells should be alive at start of the play. Otherwise the population immediately becomes extinct. The NEWX and NEWY can save the coordinates in the final configuration, or a missing value if the population is extinct. So you can restart the game (provided the population is not extinct).

The number of time steps is specified by the NTIMES option; default 200. However, the game will stop earlier if there are no changes. (This may either be because the population has become stable or because it has become extinct.)

The TITLE option can specify a title for the display. The COLOURS option can specify the colours for the plot, either as a text with two strings giving the name of the colours for the live and dead cells, or as a variate with two values giving their RGB values.

Options: NROWS, NCOLUMNS, Y, X, NEWY, NEWX, TITLE, COLOURS.

Reference

Gardner, M. (1970). Mathematical games: the fantastic combinations of John Conway’s new Solitary game ‘Life’. Scientific American223, 120-123.

See also

Procedures: BINGOFRUITMACHINENOUGHTSANDCROSSES.

Example

CAPTION 'LIFE example','Gosper Glider Gun'; STYLE=meta,plain
VARIATE [VALUES=50,49,49,48,48,48,48,48,48,47,47,47,47,47,47,46,46,46,\
                46,46,46,45,45,45,45,45,45,45,45,44,44,44,43,43,42,42] Y
VARIATE [VALUES=25,23,25,13,14,21,22,35,36,12,16,21,22,35,36, 1, 2,11,\
                17,21,22, 1, 2,11,15,17,18,23,25,11,17,25,12,16,13,14] X
LIFE    [X=X; Y=Y; NTIMES=150; TITLE='Gosper Glider Gun'] 
Updated on February 3, 2023

Was this article helpful?