Introduction
A .lif file holds a starting pattern for Conway’s Game of Life: the
cells that are alive when the game begins. It is plain text, so any text editor can
write one, and the Life programs of the early 1990s on MS-DOS and Windows, such as Al
Hensel’s Life for DOS and Dave Crawford’s Get a Life, saved and loaded patterns this
way. Collections of patterns, the glider guns, puffers and breeders that people found
over the years, were passed around as .lif files, and
Golly still reads them.
Four kinds of file share the extension. They are told apart by what the text says, not by a version number somebody hoped was right:
- Life 1.05, the format of the big pattern collections: a
#Life 1.05line, a description, the rules, and blocks of cells drawn with.and*. - Life 1.06, a later format that is only a list of the live cells as pairs of numbers.
- Files in the Life 1.05 layout with no version line, such as the 37 patterns that came with Get a Life.
- Files drawn with x, in the same collection.
The program called “Life 1.06” is not the Life 1.06 file format. Al Hensel’s MS-DOS program of that name (1994) reads and writes Life 1.05 files: its own documentation lists “#Life 1.03” as the first version line it wrote, long before. A file is a Life 1.05 file because its first line says so.
A file dropped on any of these pages opens in the explorer. It shows the pattern as a picture, one square a cell, with the origin marked; the live cells, the bounding box and the density; the description and the rules; each cell block with its position and size; and the pattern written out as text. A click on a cell selects the byte in the file that makes it, and a byte picked in the file marks its cell. Only the first generation is drawn: the explorer does not run the game.
Variations
| Format | Variation | About | Open |
|---|---|---|---|
.LIF | Life 1.05 pattern | Game of Life pattern: #Life 1.05, #D, #N or #R, #P blocks of dots and stars. | Open |
.LIF | Life 1.06 pattern | Game of Life pattern as a list: #Life 1.06, then one live cell a line, x y. | Open |
.LIF | Life pattern without a version line | Older Game of Life patterns: the Life 1.05 layout with no #Life line. | Open |
.LIF | Life pattern (x grid) | Game of Life patterns drawn as rows of x and spaces, with no header. | Open |
Life 1.05 pattern
The format of Alan Hensel’s pattern collection and of the programs that read it. A
line #Life 1.05, up to 22 description lines (#D), the
rules (#N or #R), then any number of cell blocks, each a
#P x y line and rows of . and *.
The first line is #Life, a space and a version number below 1.06.
The explorer also takes a version above 1.06 as 1.05, with a note, because the
format’s author says a higher number only means that something may be outside the
description.
Life 1.06 pattern
A list of live cells and nothing else: #Life 1.06, then a line
x y for every cell, with whole numbers of any size and sign. It has no
rules, no description and no blocks, so a pattern that is spread out costs only its
cells.
The first line is exactly #Life 1.06.
Life pattern without a version line
Older files that have the layout of Life 1.05 but no #Life line:
they start with a #P line, with a comment (##,
#O), or with the rows themselves, and the cells are written with
. and *. The 37 patterns that came with Get a Life, and
its start-up logo, are of this kind.
The first line is not #Life, every line is a directive starting with
# or a row made only of . and *, and there is
at least one row.
Life pattern (x grid)
Rows of the letter x for a live cell and a space for a dead one, with
no header and no coordinates. Four patterns of the same Get a Life collection are
written this way. A blank line is a row of dead cells.
No directives, nothing but x and spaces on any line, and at least one
x.
Telling them apart
The explorer looks at the text and tries the variants in this order, taking the first that accepts the file:
- First line
#Lifeand a version that is not 1.06, and every row made only of.and*, and every#Pline with two numbers: Life 1.05. - First line exactly
#Life 1.06, and every other line two whole numbers: Life 1.06. - No
#Lifeline, directives and rows of.and*, at least one row: no version line. - Only
xand spaces, at least onex: x grid.
A damaged file that no variant accepts is shown as the variant that read furthest
before it gave up, with each problem listed. A file with another extension is taken
only if its first line says #Life.
Other Life file formats have their own extensions and are not read here: Golly’s
run-length encoded patterns (.rle), plain-text patterns
(.cells) and Mirek’s Cellebration files (.mcl). Xlife, a
Unix Life program, uses .life as its default extension and
recognises #C for a comment where Life 1.05 has #D
(from the LIFEP collection’s WRITERS.DOC); this viewer opens .life
files as the same four variants and reads #C lines as comments.
Versions and history
What the files and documents on the Mac this site is written from say, and no more.
| Name | What it is | Source |
|---|---|---|
| x grid, no header | Patterns drawn with x and spaces | Four files in Get a Life’s PATTERNS.ZIP (1993) |
| Cell blocks, no version line | The Life 1.05 layout without its first line; one file carries the comment “converted to new format by oldpconv” | Get a Life, 1993 |
| #Life 1.03 | The first version line, added by Life 1.03 “for future compatibility checks” | The history in LIFE106.DOC |
| Life 1.05 | The description in WRITERS.DOC, “the latest”; all 150 distinct files of the LIFEP collection (1 October 1995) start with it | LIFEP.ZIP, Alan Hensel |
| Life 1.06 | A list of coordinates, one cell a line | Not seen in any file here; from memory |
The documents say the format’s author is Alan Hensel, the collector of LIFEP. Where the older Get a Life layouts come from is not stated anywhere in the files, so this page does not say.
Not described
This is what the reference leaves out and what the viewer does not do.
- Reference: Life 1.06 is from memory, with no file on the Mac to check it. The no-version-line and x-grid variants are known only from the files, and who wrote them is unknown.
- Reference: Golly reading these files is stated from memory. Other Life formats (
.rle,.cells,.mcl) are only named, not described. - Viewer: it draws only the first generation and never runs the game. Files that no variant accepts are shown as the nearest variant, with each problem listed.
- Viewer: the variant pages’ own lists give the details for each variant.
Links
Software
- Golly – free Game of Life program that opens Life 1.05 and 1.06 files and many other pattern formats (Windows, macOS, Linux)
- Life 1.06 – Alan Hensel’s MS-DOS program, the fastest of its day, with the LIFEP collection (MS-DOS)
- Get a Life – Dave Crawford’s Windows 3 program, version 1.0 (1993) (Windows)
- Xlife – Jon Bennett’s Life program for the X window system (Unix)
- WinLife – John Harper’s program (Windows 3.1)
- LifeLab – Andrew Trevorrow’s program (Mac OS)
Reference
- LifeWiki – the Game of Life wiki, which describes the pattern file formats