/
help.html
139 lines (133 loc) · 9.51 KB
/
help.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
<!doctype html>
<html>
<meta charset="utf-8">
<head>
<title>Help: Single Rotation cellular automaton with smooth interpolation</title>
<link rel="stylesheet" type="text/css" href="styles.css"/>
<link rel="stylesheet" type="text/css" href="help.css"/>
</head>
<body>
<h1>What is this?</h1>
<figure>
<a href="singlerot-smooth.html"><img src="images/singlerot-smooth.png"></a>
<a href="3d/singlerot-3d.html"><img src="images/singlerot-3d.png"></a>
<figcaption><a href="singlerot-smooth.html">2D</a> and <a href="3d/singlerot-3d.html">3D</a> visualizations</figcaption>
</figure>
<p>It's a simulator of
the <a href="http://dmishin.blogspot.com/2013/11/the-single-rotation-rule-remarkably.html">Single
Rotation</a> 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 <a href="http://dmishin.github.io/js-revca/index.html?rule=0,2,8,3,1,5,6,7,4,9,10,11,12,13,14,15&step=8&frame_delay=100&size=64x64&cell_size=6,1&phase=0">online simulator</a>.
</p>
<p>See also blog posts on them:
<ul><li>2D: <a href="http://dmishin.blogspot.com/2014/12/single-rotation-rule-with-frame.html">Single Rotation rule with frame interpolation</a>
</li>
<li>3D: <a href="http://dmishin.blogspot.com/2015/01/3d-single-rotation.html">Now in 3D (Single Rotation)</a>
</li>
</ul>
</p>
<h2>Single Rotation rule</h2>
<p>
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 <a href="http://en.wikipedia.org/wiki/Block_cellular_automaton">Margolus neighborhood</a>.
</p>
<figure>
<img src="images/single-rotation.gif">
<figcaption>Illustration of the Single Rotation rule.</figcaption>
</figure>
<p>
Despite the simplicity, complex emergent behavior appears in this rule, resembling the iconic <a href="http://en.wikipedia.org/wiki/Conway%27s_Game_of_Life">Game of Life</a>. 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 <a href="http://dmishin.github.io/js-revca/index.html?rule=0,2,8,3,1,5,6,7,4,9,10,11,12,13,14,15&step=8&frame_delay=100&size=64x64&cell_size=6,1&phase=0">online simulator</a>.
</p>
<h2>Cell tracking</h2>
<p>"Single Rotation" rule is <i>conservative</i>: 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.
</p>
<h2>Interpolation</h2>
<p>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 <a href="http://en.wikipedia.org/wiki/Lanczos_resampling">Lanczos resampling</a>.
</p>
<h2>Oscillation filtering</h2>
<p>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.
</p>
<h1><a name="version2d"></a>2D version</h1>
<h2>Using the simulator</h2>
<h3><a name="language"></a>Scene description language</h3>
<p>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.
</p>
<p>
Scene is described by a sequence of statements, separated by newlines or ";". Statement names are case-sensitive.
Four statements are supported:
<dl>
<dt><span class="command">at</span> <span class="arg1">X<span> <span class="arg2">Y</span></dt>
<dd>Sets current origin to the cell with coordinates <span class="arg1">X</span>, <span class="arg2">Y</span>. Used by the following <span class="command">rle</span> commands.</dd>
<dt><span class="command">--</span> <span class="arg1">TEXT</span></dt>
<dd>Defines description text. Several lines may be defined. Text can not contain semicolons (;).</dd>
<dt><span class="arg1">PATTERN_RLE</span></dt>
<dd>Puts given RLE code at the current coorinates. Rle code is a standard format, used by many cellular automata simulators.
<ul><li><span class="command">b</span> encodes empty cell,</li>
<li><span class="command">o</span> - alive cell,</li>
<li><span class="command">$</span> - new line,</li>
<li>numbers encode repeat count of the following character.</li>
</ul>
</dd>
<dt><span class="command">colors</span> <span class="arg1">COLOR-LIST</span></dt>
<dd>Sets current color palette. When adding patterns, new cell colors are taken from this pattern.
<span class="arg1">COLOR-LIST</span> 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: <span class="command">colors</span> <span class="arg1">red:#00ff00:rgb(0,0,255)</span>.
</dd>
</dl>
Effect of the <span class="command">at</span> and <span class="command">colors</span> statements lasts until they are redefined. Additional spaces and empty lines are ignored.
</p>
<h1><a name="version3d"></a>3D version</h1>
<p>
The 3D version visualizes world lines of cells, mapping time to 3rd dimension.
</p>
<h2>URL arguments</h2>
<p>3D application accepts a range of advanced configuration parameters
available via URL arguments. Argument names are case-sensitive.
<ul>
<li><b><a href="http://dmishin.github.io/singlerot-smooth/3d/singlerot-3d.html?antialias=true">antialias=true</a></b>
<br/>
Enables anti-aliasing, making smoother images but reducing performance.
</li>
<li><b>visibility=<i>distance</i></b><br/>
where <i>distance</i> is a number in the range 1000 ~ 50'000. It defines, how far the world lines are seen. Big distance significantly decreases FPS. Here are some sample links:
<ul>
<li><a href="http://dmishin.github.io/singlerot-smooth/3d/singlerot-3d.html?visibility=3000">visibility=3000</a> short distance, should improve FPS on slow machines.
</li>
<li><a href="http://dmishin.github.io/singlerot-smooth/3d/singlerot-3d.html?visibility=5000">visibility=5000</a> a bit shorter distance, then default.
</li>
<li><a href="http://dmishin.github.io/singlerot-smooth/3d/singlerot-3d.html?visibility=40000">visibility=40000</a> very long distance, if you don't need much FPS or have a fast machine.
</li>
</ul>
</li>
<li>Mesh generation parameters and their values:
<ul>
<li><b>chunkSize=500</b>
<br/>
number of steps in one mesh chunk
</li>
<li><b>skipSteps=1</b><br/>Generate tube section every n'th step (1 - every step)</li>
<li><b>boardSize=100</b><br/>Size of the square board, must be even</li>
<li><b>lanczosOrder=3</b><br/>Lanczos interpolation order, 1 ... 10. 1 - linear interpolation, 3 - smooth interpolation</li>
<li><b>interpSteps=1</b><br/>How many mesh steps are there between 2 generation. integer, 1 ... 4</li>
<li><b>smoothingPeriod=4</b><br/>Low-pass filter, removing oscillations with period bigger than this. integer, 1 ... 100. 1 - no filtering.</li>
<li><b>timeScale=0.1</b><br/>"speed of light". z-axis length of one generation</li>
<li><b>tubeRadius=0.1</b><br/>Radius of a single rube</li>
<li><b>tubeSides=3</b><br/>Number of sides in the tube cross-section (2...10)</li>
</ul>
</li>
</ul>
</p>
<h1>More information</h1>
<p> Here are some my pages, where you can find more information about reversible cellular automata and Single Rotation rule.
<ul>
<li><a href="http://dmishin.github.io/js-revca/index.html?rule=0,2,8,3,1,5,6,7,4,9,10,11,12,13,14,15&step=8&frame_delay=100&size=64x64&cell_size=6,1&phase=0">Online simulator</a>, uglier but more suited for experiments tool, where you can try your own patterns and rules.</li>
<li><a href="http://dmishin.blogspot.com/2013/11/the-single-rotation-rule-remarkably.html">Single rotation: remarkably simple and rich reversible cellular automaton</a> - a blog post about this rule, with some thoughts on its properties.</li>
<li><a href="http://dmishin.github.io/singlerot-spaceships/singlerot-spaceships.html">A table of the Single Rotation spaceships</a> - result of the automatic search for the spaceships (patterns that travel along the grid). Lists more than 300 different patterns.</li>
<li>And a <a href="http://dmishin.blogspot.hu/2014/07/single-rotation-spaceships-205-of-them.html">blog post</a> about the above table.
</ul>
</p>
<h1>Source code and license</h1>
<p>Source code is <a href="https://github.com/dmishin/singlerot-smooth">available on Github</a>, under the permissive MIT license. It is written in CoffeeScript.
</p>
</body>
</html>