r-format vs table-format
Posted: June 26th, 2012, 3:18 am
Google wiki page (http://code.google.com/p/ruletablerepos ... /TheFormat) about n-state rules in xlife r-formats has a cite "The problem is that it doesn't provide enough compression." It asserts that table-format has better compression. I've just performed appropriate measurements. I use table2r utility from Xlife 6.5 distribution (http://http://litwr2.atspace.eu/xlife.php). This utility is written in Awk so it may be used at any platform. The results (sizes in bytes) are shown in the next table.
The table-format shows a slightly better compression only with automata with more than 30 states. So the wiki page phrase is incorrect in general. Eric Raymond's r-format may provide better compression in many cases. IMHO the table-format has a bit higher level and a bit more expressive. The table-format can easily use any number of states--the r-format is more inflexible here. Maybe the table-format has also better compression for Moore neighborhood but this is not tested--the current version of Xlife and table2r doesn't support such n-state automata.
The utility table2r may directly run from Unix like environment, e.g.,
where INFILE must be input table-format file and OUTFILE must be the resulting r-format file.
Awk has several variants (bawk, gawk, mawk) which is freely available for Microsoft Windows and Apple OS. Run
The table-format rules were taken from Golly distribution and from Nicolas Oros's website.
Code: Select all
Rules |states|r-format|table-format|ratio
--------------------------------------------------
Byl-Loop |6 |1487 |1493 |+0%
Chou-Reggia1 |8 |1683 |1689 |+0%
Chou-Reggia2 |8 |919 |925 |+0%
Codd |8 |4816 |8001 |+66%
Codd2 |8 |5535 |8756 |+58%
Devore |8 |3987 |6316 |+58%
Evoloop |9 |3461 |4828 |+39%
Evoloop-finite |10 |2547 |3914 |+54%
F-sexyloop |12 |6283 |9817 |+56%
HPP |34 |4800 |2726 |-43%
Langton-Loops |8 |1921 |1927 |+0%
Perrier |64 |11917 |9737 |-18%
SDSR-loop |9 |3717 |5019 |+35%
Sexyloop-M1 |10 |3555 |3528 |-0%
Sexyloop-M2 |10 |3430 |3403 |-0%
The utility table2r may directly run from Unix like environment, e.g.,
Code: Select all
table2r INFILE OUTFILEAwk has several variants (bawk, gawk, mawk) which is freely available for Microsoft Windows and Apple OS. Run
Code: Select all
awk -f table2r INFILE OUTFILE