Life 1.05

From LifeWiki
Jump to: navigation, search

The Life 1.05 file format is an ASCII format for storing Life patterns by simply using dots (.) to represent dead cells and asterisks (*) to represent alive cells. This file format was designed to be easily ported; you can look at a pattern saved in this format in a text editor and figure out what it is. Life 1.05 files are saved with a .lif or .life file extension.

Description of format

The first line is a header line that indicates the format of the file:

#Life 1.05

This header line is optionally followed by several description lines of the following form:

#D This is some text.
#D       This is some text.      

Each description line should contain no more than 78 characters of text after #D, and leading and trailing spaces have no effect (so the two description lines above are equivalent). In fact, all lines of the file must similarly be restricted to no more than 80 characters in length. There should be no more than 22 "#D" lines in a Life 1.05 file.

Next comes an optional rule specification. If no rules are specified, then the pattern will run with whatever rules the Life program is currently set to. The file may enforce "normal" Life rules using the "#N" specifier. Alternate rules use "#R" ("#N" is exactly the same as "#R 23/3"). Rules are encoded as Survival/Birth, each list being a string of digits representing neighbor counts. Since there are exactly eight possible neighbors in a Conway-like rule, there is no need to separate the digits, and "9" is prohibited in both lists. For example,

#R 125/36

means that the pattern should be run in a universe where 1, 2, or 5 neighbors are necessary for a cell's survival, and 3 or 6 neighbours allow a cell to come alive.

Lastly come the lines representing the cell blocks. Each cell block begins with a "#P" line, followed by the x and y coordinates of the upper-left hand corner of the block, assuming that 0 0 is the center of the current window to the Life universe. For example,

#P -1 4

This is followed by lines that draw out the pattern in a visual way, using the "." and "*" characters to represent dead and alive cells, respectively. Each line must be between 1 and 80 characters wide, inclusive; a blank line is represented by a single dot, whereas any other line may truncate all dots to the right of the last "*". There is no limit to the number of cell blocks or the number of lines in a cell block.

Any line of zero length (just another carriage return) is completely ignored. Line breaks are MS-DOS-style (both carriage return and linefeed).


The following is a glider in Life 1.05 format:

#Life 1.05
#D This is a glider.
#P -1 -1

External links