What is this?

2D and 3D visualizations

It's a simulator of the Single Rotation cellular automaton, that tracks positions of the cells and uses Lanczos interpolation to add an intermediate frames. Its primary purpose is a nice visual effect, a better tool for experiments with reversible cellular automata is the online simulator.

See also blog posts on them:

Single Rotation rule

This cellular automaton acts on a grid of cells, where each cell is either dead or alive. On each generation, the grid is divided into 2x2 blocks, and if the block contains exactly one alive cell, the block is rotated by 90°. Thus "single rotation". After each generation, the 2x2 subdivision is alternated. This scheme is known as Margolus neighborhood.

Illustration of the Single Rotation rule.

Despite the simplicity, complex emergent behavior appears in this rule, resembling the iconic Game of Life. One important difference is that "Single Rotation" is time-reversible, that is: for every state it is always possible (and easy) to calculate previous state. You can play with this rule in the online simulator.

Cell tracking

"Single Rotation" rule is conservative: it preserves total number of alive cells. Moreover, from the definition of the rule it is clear that it is possible to track position of the every individual alive cell. The application does this idea.

Interpolation

Cell coordinates are discrete, alive cells are "jumping" by 1 unit in some direction. To make animation more visually pleasing, this simulator interpolates intermediate positions, using Lanczos resampling.

Oscillation filtering

One can easily check that in the "Single Rotation" rule a single cell would constantly rotate with period 4. To make this less annoying, a possibility to filter higher frequencies of the cell movement is added. For example, when "filter" setting is 4, then every oscillation with period 4 or less is replaced by the constant average value, and rotating cells visually stand still. Higher filter setting allow to cease oscillations of higher period. This is also done by Lanczos filter.

2D version

Using the simulator

Scene description language

Both 3d and 2d simulators use a simple language to describe loaded scenes, that is superset of the RLE (i.e. bare RLE code for the pattern is a valid scene description). The language makes it simpler to combine multiple patterns and assign colors to cells.

Scene is described by a sequence of statements, separated by newlines or ";". Statement names are case-sensitive. Four statements are supported:

at X Y
Sets current origin to the cell with coordinates X, Y. Used by the following rle commands.
-- TEXT
Defines description text. Several lines may be defined. Text can not contain semicolons (;).
PATTERN_RLE
Puts given RLE code at the current coorinates. Rle code is a standard format, used by many cellular automata simulators.
colors COLOR-LIST
Sets current color palette. When adding patterns, new cell colors are taken from this pattern. COLOR-LIST can be either a ":"-separated list of any CSS colors, or the text "default". In the latter case, pattern is returned to the default. Example: colors red:#00ff00:rgb(0,0,255).
Effect of the at and colors statements lasts until they are redefined. Additional spaces and empty lines are ignored.

3D version

The 3D version visualizes world lines of cells, mapping time to 3rd dimension.

URL arguments

3D application accepts a range of advanced configuration parameters available via URL arguments. Argument names are case-sensitive.

More information

Here are some my pages, where you can find more information about reversible cellular automata and Single Rotation rule.

Source code and license

Source code is available on Github, under the permissive MIT license. It is written in CoffeeScript.