Introduction
A .cells file draws a Game of Life pattern as text. A . is a dead cell and a capital O is a live one, one line to a row, and comment lines that start with ! give the name, the author and a description. A glider is three lines: .O., ..O and OOO. You can see the pattern by looking at the file. The LifeWiki calls the format Plaintext, and offers its patterns in this form as well as in RLE. The layout is the one of Edwin Martin’s Game of Life program, and Golly opens it.
The file keeps no rule and no position. Whoever opens it assumes Conway’s Life, and the first row is row 0. Because every cell is a character, the file is as large as the pattern’s box, so large or sparse patterns are better kept as RLE or macrocell.
Lines
A file is lines of text ending in CR, LF or CR LF. The first character of the line says what it is.
| Line | Meaning |
|---|---|
!Name: text | The name of the pattern. This is the first line. |
!Author: text | The author, and often the date of discovery. The LifeWiki’s own files write it second; it is a custom and not part of the description of the format. |
!text | A comment: a description of the pattern, often a link to its LifeWiki page. Comment lines may be put in any number after the name. |
! alone | A comment with nothing in it. Many files put one last before the rows; it is optional. |
| any other line | A row of cells, from the top row down. A line with nothing on it is a row of dead cells. |
!Name!Name: Glider1 line!Comments author, description, linksany number of lines.O.Rows.dead,Oaliveany number of lines
Rows
Each character of a row is one cell, from the left.
| Character | Meaning |
|---|---|
. | A dead cell. |
O | A live cell. This is a capital letter o, not a zero. |
There is no limit on the length of a line. The first row is row 0 and the first column is column 0, so the pattern’s upper left corner is at 0, 0 and the rows may be of different lengths. Older files have some variations, which the LifeWiki says should be corrected: dead cells at the end of a row left off (the LifeWiki’s own files do this too), rows of only dead cells left completely blank, and * used for a live cell, as Life 1.05 does it.
An example
21 4E 61 6D 65 3A 20 47 6C 69 64 65 72 0A !Name: Glider
2E 4F 2E 0A .O.
2E 2E 4F 0A ..O
4F 4F 4F 0A OOO
Five live cells in a box of 3 × 3.
How Golly reads it
Golly decides by the first line that is not blank. If it starts with ! the file is read as David Bell’s DBLife format, which is a superset of plaintext: every line that does not start with ! is a row, blank lines included, and a ! line anywhere is skipped and does not count as a row. In a row . is a dead cell and O a live one; a number in front of either repeats it (3.2O is three dead cells and two live ones); any other character is ignored without a message. Cells are not counted for it: * and a lower case o make no live cell.
A file whose first line does not start with ! (and is not RLE or another format Golly knows) is read as text instead: ., , and every character up to a space are dead cells, $ is ten dead cells and every other character is a live cell. A file of rows only, with * or O, therefore opens.
In the explorer
Drop a pattern on the explorer and it shows the cells as a picture with the facts: name, author, number of rows and the longest one, live cells, bounding box, characters Golly would skip, and the line endings. Every line is in the tree, and the problems found are listed on the line they belong to: a first line that is not !Name:, * or o used for a live cell, digit counts, and ! lines after the cells. The pattern can be run with Conway’s rule for a number of generations with the Generation option. A pattern too big for one picture is shown a window at a time. A file with no ! lines, named .cells, is read the way Golly’s text reader does.
Not described
What this reference leaves out and what the viewer does not do.
Known, not yet covered
- Reference: Edwin Martin’s own description of the format and what his program accepts has not been read; the description here is the LifeWiki’s and Golly’s reader (
readdblifeandreadtextpatterningollybase/readpattern.cpp). Other programs’ handling of rows with other characters is not described. - Reference: the commands of DBLife files other than the counts (Golly ignores them), and what the format of DBLife itself says, are not described.
- Viewer: only Conway’s rule is run. The format stores no rule, so a pattern made for another rule is shown as it is written.
Other Game of Life pattern formats
- Golly RLE pattern (.rle) – run-length encoded cells with a rule, the usual way to share patterns
- Game of Life pattern (.lif) – Life 1.05, Life 1.06 and plain grids
- Golly macrocell (.mc) – a universe as a quadtree, for patterns of astronomical size
- MCell pattern (.mcl) – the format of the MCell program
Links
Software
- Golly – free Game of Life and cellular automata program that opens and saves plaintext patterns (Windows, macOS, Linux)
Reference
- Plaintext – the LifeWiki page on the format
- Golly file formats – Golly’s description of the formats it reads and writes