RuleLoader

From Esolang
Jump to navigation Jump to search
This article is not detailed enough and needs to be expanded. Please help us by adding some more information.

RuleLoader is the algorithm used to simulate .rule files describing different types of CA, also known as rule tables and rule trees. A description of the file format is provided in Golly's built-in help.[1][2]

RuleLoader is capable of describing CA rules of different kinds, including asymmetric rules and hexagonal rules.

Description

The RuleLoader algorithm allows rules to be specified in external files. Given the rule string "Foo", RuleLoader will search for a file called Foo.rule.[1]

A .rule file contains all the information about a rule: its name, documentation, table/tree data (used by the RuleLoader algorithm), and any color/icon information. The .rule format is textual and consists of one or more sections. Each section starts with a line of the form @XXX... where X is an uppercase letter. If there is more than one section with the same name then only the first one is used. Any unrecognized sections are silently ignored.[2]

The currently recognized sections are:[2]

  • @RULE (mandatory, and must match the file name)
  • @TABLE (optional, but mandatory when @TREE is not present)
  • @TREE (optional, but mandatory when @TREE is not present)
  • @COLORS (optional: sets the color of each state, if not present, show as from red to yellow)
  • @ICONS (optional: sets the icon of each state, if not present, show as diamonds for vonNeumann, skewed hexagon for Hexagonal, or circles)
  • @NAMES (optional: doesn't work in Golly but [lazyslug.com LifeViewer] sets the name of each state)

Syntax

@RULE

@RULE RuleName

where RuleName is the name of the rule. It must be the same as the file name.

@COLORS

Num Red Green Blue Note

where Num is the cell state number;
Red, Green and Blue is the color, each 0-255;
Note is optional, you can write anything here.

FromR FromG FromB ToR ToG ToB

Gradients.

@ICONS

XPM
xpxpict

where xpmpict is a long picture, written in XPM format.
The width must be one of 7, 15, 31. The height is either the same of the width, or number of states times width.

@NAMES

Num Name

where Num is the cell state number;
Name is the cell name.

@TREE

This section is human-unfriendly, and usually generated by scripts.

@TABLE

n_states: NumStates
neighborhood: Neighbor
symmetries: Symmetry
Transitions

where NumStates is the number of cells;
Neighbor is the neighborhood, one of

hexagonal vonNeumann oneDimensional Moore

Symmetry is the neighborhood, one of

none permute rotate4 rotate4reflect

in Transitions, there are 2 type of commands.

var SetName = {Contents}

defines a set.

C,Conditions,NewC

defines a transition.

Computational class

Rule Table is a meta-language, and thus a direct classification of its computational power is impossible. It can, however, describe John Conway's Game of Life, which is known to be Turing-complete. It might be argued, therefore, that Rule Table is "meta Turing-complete" (that is, able to describe Turing-complete systems.)

Also, any meta-language-plus-input is equivalent to a programming language. So a trivial extension to Rule Table which turns it into a Matrioshka language (like Thue or ODDBALL) would be Turing-complete.

User:ZCX islptng has made a UTM simulator in RuleLoader, available here.

See also

References