Introduction
An MCL file is a pattern for MCell, the cellular automata program by Mirek Wojtowicz (it began as MCLife). It is a text file that says which kind of automaton it is for, the rule, the size and edges of the board, how to show it, a description, and the cells themselves. MCell handles many kinds of automaton: Life, Generations, Larger than Life, WireWorld-like rule tables, one-dimensional rules and more, and the file format carries them all. It combines the Life 1.05 layout (a line of directives for each setting) with run-length encoded cells like RLE, and allows up to 256 states.
Golly reads MCL files too, which is why its Patterns folder has a set of WireWorld circuits in them.
Directives
Every line is a directive that starts with #, in upper case. Only #MCell must be present. Lines that do not start with # are not part of the format.
| Directive | Meaning | Default |
|---|---|---|
#MCell 4.20 | The first line: file type and the version of the syntax. | required |
#GAME name | The kind of rule: Life, Generations, Weighted Life, Vote for Life, Rules table, Cyclic CA, 1-D binary, 1-D totalistic, Neumann binary, General binary, Larger than Life, Margolus, Weighted Generations, User DLL, or Special rules. | Life |
#RULE text | The rule as text, in the syntax of the game. A long rule can continue on further #RULE lines (since MCell 2.30). For Life: 23/3, survival digits then birth digits. For Generations: 345/34/6, survival, birth, number of states. | 23/3 |
#SPEED n | Milliseconds a generation takes, 0 to 5000; 0 is as fast as possible. | no change |
#BOARD wxh | The size of the board in cells, like 300x300. | no change |
#CCOLORS n | The number of states (colours), 2 to 256. Ignored by rules that give their own number of states, such as Generations. | no change |
#COLORING n | How rules without history are coloured: 1 standard, 2 alternate. | no change |
#WRAP n | 1 joins the edges of the board, 0 leaves them open. | no change |
#PALETTE name | The name of the colour palette. | none |
#D text | A line of description. Any number of lines. | none |
#DIV … | Diversities (random disturbances): #SYSTEM switches them on or off, #NOISE, #BHOLE, #SNOVA and #STRIN give the parameters of noise, black holes, supernovae and string injection, as name=value pairs. | none |
#L cells | A line of the pattern. | no cells |
Golly also accepts #GOLLY rule, a rule written the way Golly names it (such as WireWorld), in place of #RULE. Golly looks for exactly #L (with the space), #BOARD and #WRAP .
#MCellVersion line#MCell 4.201 line#GAMESettings game, rule, board, wrap, speed, colours, palette0 or more lines#DDescription0 or more lines#LCells run-length text, over as many lines as needed0 or more lines
The cells
The text after #L is a run-length encoded picture. All the #L lines together are one picture: the position carries on from one line to the next, so a row or a run may be broken over two lines between tokens (a token is a count and its symbol). MCell writes lines up to 70 characters long; any length is read. Spaces are ignored.
| Symbol | Meaning |
|---|---|
. | A dead cell, state 0. |
A to X | States 1 to 24. |
a to j and then A to X | States above 24. The lower case letter adds 24 for a, 48 for b, and so on to 240 for j: aB is state 26. |
$ | The end of a row. With a count, that many row ends. |
| a number before a symbol | Repeats it: 9. is nine dead cells. A count of 0 is read as 1. |
Any other character is an error: Golly reports “Illegal multi-char state”.
Where the cells go
The format does not say what coordinates the first cell has. Golly starts at 0, 0, or, when a #BOARD line comes first, at the top left corner of the board, which is −w/2, −h/2 (whole division). After a board is read Golly moves the pattern to the middle of it: it shifts the cells by (w + 1 − pattern width)/2 across and (h + 1 − pattern height)/2 down, when either is above 0; this puts the pattern where MCell does. A $ goes back to the left edge of the board.
An example
A glider for the Life game, line endings 0A.
23 4D 43 65 6C 6C 20 34 2E 32 30 0A #MCell 4.20
23 47 41 4D 45 20 4C 69 66 65 0A #GAME Life
23 52 55 4C 45 20 32 33 2F 33 0A #RULE 23/3
23 4C 20 2E 41 24 2E 2E 41 24 33 41 0A #L .A$..A$3A
The rows are .A, ..A and AAA: five live cells.
In the explorer
The explorer shows the cells as a picture, with the game, the rule (and, where Golly reads it as a named rule, that name), the board and wrap, the colour and speed settings, the description, the number of live cells, the states used and the box round them. Every byte is in the tree: each line, and for a line of cells each token. A pattern for the Life or Generations game can be run for a number of generations, on its board when it has one, with the rule runner described on the RLE page; other games are shown as the cells of the file. A pattern too big for one picture is shown a window at a time.
Not described
What this reference leaves out and what the viewer does not do.
Known, not yet covered
- Reference: the directives and the cell text are described from MCell’s own description of the format (mcell.ca) and the source of Golly’s reader (
readmcellingollybase/readpattern.cpp). The rule syntax of each of the fifteen games, except Life and Generations, is in MCell’s help and is not described here. The#DIVparameters and the exact placement of the cells on a board in MCell itself (as against Golly) are not described. - Viewer: the rule text is shown, and the Life and Generations games are run as the rules Golly reads them as; the other games (WireWorld, Cyclic and the rest) are shown as the cells of the file, not run. The page that describes each game’s rule syntax (Mirek Wójtowicz’s file format page on mirekw.com) did not open when this was tried, so that part is still unread. Colours come from the viewer’s palette, not from
#PALETTE.
Other Game of Life pattern formats
- Game of Life pattern (.lif) – Life 1.05, Life 1.06 and plain grids
- Golly RLE pattern (.rle) – run-length encoded text, the usual way to share a pattern
- Golly macrocell (.mc) – a universe as a quadtree, for patterns of astronomical size
Links
Software
Reference
- MCell – the MCL format description, with every directive