Life 1.05: Difference between revisions
m fixed typo |
replaced <code> blocks with <pre> blocks |
||
| (9 intermediate revisions by 6 users not shown) | |||
| Line 1: | Line 1: | ||
The '''Life 1.05''' file format is an ASCII format for storing [[Life]] [[pattern | The '''Life 1.05''' file format is an ASCII [[File formats|file format]] for storing [[Life]] [[pattern]]s 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 <code>.lif</code> or <code>.life</code> file extension. | ||
==Description of format== | ==Description of format== | ||
The first line is a header line that indicates the format of the file: | The first line is a header line that indicates the format of the file: | ||
< | <pre>#Life 1.05</pre> | ||
This header line is optionally followed by several description lines of the following form: | This header line is optionally followed by several description lines of the following form: | ||
< | <pre>#D This is some text. | ||
#D This is some text. </pre> | |||
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. | 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. | ||
| Line 15: | Line 15: | ||
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, | 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, | ||
< | <pre>#R 125/36</pre> | ||
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. | 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. | ||
| Line 21: | Line 21: | ||
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, | 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, | ||
< | <pre>#P -1 4</pre> | ||
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. | 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. | ||
| Line 28: | Line 28: | ||
==Examples== | ==Examples== | ||
The following is a [[glider]] in | The following is a [[glider]] in Life 1.05 format: | ||
< | <pre> | ||
#Life 1.05 | |||
#D This is a glider. | |||
#N | |||
#P -1 -1 | |||
.*. | |||
..* | |||
< | *** | ||
</pre> | |||
==See also== | |||
* [[Life 1.06]] | |||
* [[Plaintext]] | |||
* [[RLE]] | |||
* [[File formats]] | |||
==External links== | ==External links== | ||
* | * {{LinkMirek|ca_files_formats.html|title=Cellular automata file formats}} | ||
[[Category:Everything else]] | |||
[[Category:File formats]] | |||
__NOTOC__ | |||
Latest revision as of 03:56, 15 December 2024
The Life 1.05 file format is an ASCII file 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).
Examples
The following is a glider in Life 1.05 format:
#Life 1.05 #D This is a glider. #N #P -1 -1 .*. ..* ***
See also
External links