Cellular Automata files formats

MCL is a relatively new Cellular Automata file format introduced with MCLife 1.20, and continued
in MCell. Its an ASCII format combining both Life 1.05 and RLE and introducing extensions necessary to store all MCell features.

Optional rule expressed as text; default is '23/3'. Since the version 2.30
long rules can be split into several #RULE lines. Example:#RULE 345/34/6
or#RULE
NW4,NN1,NE0,WW1,ME0,EE4,SW0,SS4,SE1,HI0,RS2,RS3,RS6,RS7,RS8,RS9,
#RULE RS11,RS12,RS13,RS14,RS15,RB5,RB10,RB11,RB14,RB15

#SPEED

Optional game speed, 0..5000, 0 is fastest, 5000 is 5 seconds per
generation; if the parameter is missing, default is 'no change'. Example:#SPEED 50

Optional count of states (colors), 2..256; if the parameter is missing,
default is 'no change'. This parameter is ignored in rules defining the count of colors,
for example in Generations family. Example:#CCOLORS 16

#COLORING

Optional coloring method for rules without history. 1 is standard, 2 is
alternate; if the parameter is missing, default is 'no change'. Example:#COLORING 2

#WRAP

Optional 'wrap at edges' flag, 1 or 0; if the parameter is missing,
default is 'no change'. Example:#WRAP 0

This ASCII format just draws the pattern with "." and "*" symbols.
The lines length should not exceed 80 characters.

The "#Life" line is followed by optional description lines, which begin with
"#D" and are followed by no more than 78 characters of text. Leading and
trailing spaces are ignored, so the following two "#D" lines are equivalent:

#D This is a Description line
#D This is a Description line

There should be no more than 22 "#D" lines in a .LIF 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 patterns in the
collection here enforce "Normal" Conway 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 neighbors allows a cell to come alive.

Next come the cell blocks. Each cell block begins with a "#P" line, followed
by "x 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.

This is followed by lines that draw out the pattern in a visual way, using the
"." and "*" characters (off, on). Each line must be between 1 and 80
characters wide, inclusive; therefore, 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 lines in a cell block.

Any line of zero length (just another carriage return) is completely ignored. Carriage
returns are MSDOS-style (both 10 and 13).

For example, a glider in Life1.05 format is saved as:

#Life 1.05

***
*..
.*.

Life 1.05 format was designed to be easily ported. You can just look at a pattern in
this format in a text editor, and figure out what it is. Alan Hensel's pattern collection
(http://www.mindspring.com/~alanh/lifep.zip)
is stored in Life 1.05 format.

This ASCII format is just a list of alive cells. Life 1.06 was designed to be easy and
quick for the Life program to write. It turns out that for Life 1.05
it is very hard to find a quick, optimal algorithm for choosing cell blocks. So this
format is just a list of (x y) coordinates with live cells, which could potentially be
very long.

RLE ("Run Length Encoded") format is best for larger patterns. It is more
cryptic, but not terribly so.

The first line is a header line, which has the form

x = m, y = n

where m and n are the dimensions of the pattern. RLE-writers should produce spacing as
shown, but RLE-readers are best not to assume this spacing because it isn't clear that it
was originally mandated.

The pattern itself begins on the next line and is encoded as a sequence if items of the
form <run_count><tag>, where <tag> is one of the following

b = a dead cell
o = a live cell
$ = end of a line of the pattern

and <run_count> is the number of occurrences of <tag> and can be omitted if
equal to 1. The last <run_count><tag> item is followed by a ! character. Dead
cells at the end of a pattern line do not need to be encoded, nor does the end of the last
line of the pattern. Whitespace is permitted between <run_count><tag> items
(and between the last <run_count><tag> item and the following !), but except
for carriage returns and line feeds this is not recommended. It is not permitted to place
whitespace in the middle of a <run_count><tag> item, although it's a good idea
for RLE-readers to be able to cope with this anyway.

Lines in the RLE file must not exceed 70 characters, but again it's a good idea for
RLE-readers to be able to cope with longer lines. DOS, Unix and Mac newline conventions
are all acceptable.

Anything after the final ! is ignored. It used to be common to put comments here
(starting on a new line), but the usual method for adding comments is now by means of #C
lines (see below).

Later RLE enhancements

(1) The header line may be preceded by any number of lines beginning with the #
character. The # is followed by a letter indicating the type of information that the line
provides. These letters generally follow the conventions for XLife files which are
described in the file xlife.man in the XLife distribution, although some of the letters
described there are not necessarily meaningful in RLE files. An RLE-reader should ignore
any line marked with a letter it does not know about. Here is a list of letters likely to
be encountered in practice:

C - indicates that a line of comment follows. This is the only really common use
of # lines. Example:

#C 'Twas brillig and the slithy toves

c - same as C, but not really correct. Example:

#c Did gyre and gimble in the wabe.

O - says when and by whom the file was created. RLE files produced by XLife usually
have this line. Example:

#O ook "The Librarian"@unseen.edu Fri Apr 30 19:38:52 1999

P - essentially the same as R. This line is produced by Life32, which generates
coordinates which probably won't be of use to anyone unless the user has taken care to
make sure they are (which is unlikely). Best ignored. Example:

#P 90 136

R - gives the coordinates of the top left-hand corner of the pattern. RLE files
produced by XLife usually have this line, and the coordinates are usually negative with
the intention of placing the centre of the pattern at the origin. Example:

#R -22 -57

r - gives the rule for a totalistic cellular automaton in the form
survival_counts/birth_counts (e.g. 23/3 for Life). This line is usually present in RLE
files created by XLife. But the normal method of indicating the rule is described in (2)
below. Example:

#r 23/36

(2) The rule for which the pattern is designed can be indicated in the header line,
which then takes the form

x = m, y = n, rule = abc

where abc is the rule's designation, such as B36/S23 for HighLife. This type of
extended header line is usual whenever the pattern is not intended for Conway's Life. As
with ordinary header lines, RLE-writers should adhere to the spacing shown, but
RLE-readers are best not to assume it.

(3) Letters other than b and o may be used for the <tag>s to represent extra
states. Unless the cellular automaton has more than 26 states it's a good idea to stick to
lowercase letters. RLE-readers that cannot handle more than two states should treat all
letters other than b (and perhaps B) as equivalent to o.

For example, the following is the common glider in RLE format:

x = 3, y = 3
3o$o$bo!

The large Mark D. Niemiec's site (http://home.interserv.com/~mniemiec/)
has thousands of files saved in RLE format. The files contain an RLE file syntax extension
- they use x, y, and z characters to denote 3 more
cell states.

ProLife is the only popular binary file format used for storing Cellular Automata
files. The authors of the format did several tricks to make this format hard to decipher.
Note that ProLife patterns are limited to a maximal width of 320 cells.

This was developed at about the same time as the Life 1.05 format,
for the same reasons, and the results are very similar.

XLife recognizes the symbol "#C" for a comment, instead of "#D".
Many XLife patterns contain also the #O keyword that says when and by whom the file was
created. The default extension is ".life" instead of ".LIF".