Small object format: Difference between revisions
Jump to navigation
Jump to search
m SOF moved to Small object format: full name |
Neocaridina (talk | contribs) No edit summary |
||
| (7 intermediate revisions by 5 users not shown) | |||
| Line 1: | Line 1: | ||
The '''small object format''' (or '''SOF''' for short) is a file format designed by [[Heinrich Koenig]] that is primarily used for storing multiple [[pattern]]s in a single file, with one object per line in the file. It is about as human-readable as an [[RLE]] file, but it has the added benefit of increased compression. | The '''small object format''' (or '''SOF''' for short) is a [[File formats|file format]] designed by [[Heinrich Koenig]] that is primarily used for storing multiple [[pattern]]s in a single file, with one object per line in the file. It is about as human-readable as an [[RLE]] file, but it has the added benefit of increased compression. | ||
==Description of format== | ==Description of format== | ||
Each object takes up one line in an ASCII file. The format itself specifies each line as an alternating list of ON and OFF [[cell]]s, starting with an ON cell. | Each object takes up one line in an ASCII<ref>{{LinkWikipedia|ASCII|pagename=ASCII|nobullet=nobullet}}</ref> file. The format itself specifies each line as an alternating list of ON and OFF [[cell]]s, starting with an ON cell. | ||
Using the minimal [[bounding box]], a single object is specified as follows: | Using the minimal [[bounding box]], a single object is specified as follows: | ||
# If the line starts with off cells, write "0". Otherwise, skip this step. | # If the line starts with off cells, write "0". Otherwise, skip this step. | ||
# If the count of consecutive cell of the same type (ON or OFF) is no more than 78, write the count of consecutive cells as ASCII(x + 0x30). For counts of 0-9, this results in the characters "0" through "9" | # If the count of consecutive cell of the same type (ON or OFF) is no more than 78, write the count of consecutive cells as ASCII(x + 0x30). For counts of 0-9, this results in the characters "0" through "9". Otherwise, skip this step. | ||
# If the count of consecutive cell of the same type (ON or OFF) is larger than 78, write the 78 using the encoding given in Step 2 (which gives "~"), then a "0" to signify a zero length run, followed by the value for (count-78), as described in Step 2. Repeat as necessary. For example, a count of 80 would be encoded as "~02". | # If the count of consecutive cell of the same type (ON or OFF) is larger than 78, write the 78 using the encoding given in Step 2 (which gives "~"), then a "0" to signify a zero length run, followed by the value for (count-78), as described in Step 2. Repeat as necessary. For example, a count of 80 would be encoded as "~02". | ||
# At the end of a row of a pattern, write "-". For patterns containing multiple blank lines, write "+" followed by the count of consecutive line feeds as ASCII(x + 0x30). Thus "3+43." is equivalent to "3----3." (two horizontal blinkers separated by three blank rows). | # At the end of a row of a pattern, write "-". For patterns containing multiple blank lines, write "+" followed by the count of consecutive line feeds as ASCII(x + 0x30). Thus "3+43." is equivalent to "3----3." (two horizontal blinkers separated by three blank rows). | ||
| Line 17: | Line 17: | ||
The following is a [[glider]] in SOF format: | The following is a [[glider]] in SOF format: | ||
< | <pre> | ||
3-12-0111. (Glider) !This is a glider | |||
</ | </pre> | ||
==See also== | |||
* [[File formats]] | |||
==References== | |||
<references /> | |||
==External links== | ==External links== | ||
*[http:// | * [https://web.archive.org/web/20211102020428/http://pentadecathlon.com/objects/definitions/definitions.php Description of SOF file format] at pentadecathlon.com | ||
[[Category:Everything else]][[Category:File formats]] | [[Category:Everything else]] | ||
[[Category:File formats]] | |||
[[Category:Algorithms]] | |||
__NOTOC__ | |||
Latest revision as of 18:48, 20 January 2026
The small object format (or SOF for short) is a file format designed by Heinrich Koenig that is primarily used for storing multiple patterns in a single file, with one object per line in the file. It is about as human-readable as an RLE file, but it has the added benefit of increased compression.
Description of format
Each object takes up one line in an ASCII[1] file. The format itself specifies each line as an alternating list of ON and OFF cells, starting with an ON cell.
Using the minimal bounding box, a single object is specified as follows:
- If the line starts with off cells, write "0". Otherwise, skip this step.
- If the count of consecutive cell of the same type (ON or OFF) is no more than 78, write the count of consecutive cells as ASCII(x + 0x30). For counts of 0-9, this results in the characters "0" through "9". Otherwise, skip this step.
- If the count of consecutive cell of the same type (ON or OFF) is larger than 78, write the 78 using the encoding given in Step 2 (which gives "~"), then a "0" to signify a zero length run, followed by the value for (count-78), as described in Step 2. Repeat as necessary. For example, a count of 80 would be encoded as "~02".
- At the end of a row of a pattern, write "-". For patterns containing multiple blank lines, write "+" followed by the count of consecutive line feeds as ASCII(x + 0x30). Thus "3+43." is equivalent to "3----3." (two horizontal blinkers separated by three blank rows).
- At the end of the pattern, write "."
- Comments can be included; everything following an exclamation mark ("!") is assumed to be a comment and is ignored.
- Text entered within parentheses "(name right here)" is assumed to be the name of the pattern. This should be entered after the "." but before the comment exclamation mark, if one is included.
- Text before "!" and outside "( ... )" is not ignored.
Examples
The following is a glider in SOF format:
3-12-0111. (Glider) !This is a glider
See also
References
External links
- Description of SOF file format at pentadecathlon.com