-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
329 lines (285 loc) · 21.1 KB
/
index.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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
<!DOCTYPE html>
<html class="no-js tab-inactive show-instructions" lang="en">
<head>
<meta charset='utf-8'>
<title>Cellular Automata Playground</title>
<meta name='description' content='Create simple lines, fractal geometries, or non-repeating complex structures, based on a handful of elementary rules.'>
<meta name="viewport" content="width=device-width, initial-scale=1">
<script>
(function(doc) {
doc.className = doc.className.replace(/(^|\b)no\-js(\b|$)/, 'js');
if (('ontouchstart' in window) || (navigator.msMaxTouchPoints > 0)) {
doc.className += ' touch';
}
}(document.documentElement));
</script>
<link href="css/style.min.css" rel="stylesheet">
<link href='https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,600' rel='stylesheet'>
<meta property="og:title" content="Cellular Automata Playground" />
<meta property="og:url" content="http://bellandwhistle.net/cellular-automata-playground/" />
<meta property="og:description" content="Explore the strange mathematical world of one-dimensional cellular automata. Create simple lines, fractal geometries, or non-repeating complex structures, based on a handful of elementary rules. This site is inspired by the work of Stephen Wolfram." />
<meta property="og:image" content="http://bellandwhistle.net/cellular-automata-playground/ca-screenshot.png">
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:site" content="@tweetywheaty">
<meta name="twitter:creator" content="@tweetywheaty">
<meta name="twitter:title" content="Cellular Automata Playground">
<meta name="twitter:description" content="Explore the strange mathematical world of cellular automata. Create simple lines, fractal geometries, or non-repeating complex structures, based on a handful of elementary rules.">
<meta name="twitter:image" content="http://bellandwhistle.net/cellular-automata-playground/ca-screenshot-shorter.png">
</head>
<body>
<button class="main-menu-button" data-show-menu >
<div class="main-menu-button__circle">
<svg class="main-menu-button__svg"xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 100 100" xml:space="preserve">
<polygon points="53.14,79.39 53.14,53.14 79.39,53.14 79.39,46.86 53.14,46.86 53.14,20.61 46.86,20.61 46.86,46.86 20.61,46.86
20.61,53.14 46.86,53.14 46.86,79.39 "/>
</svg>
</div>
<div class="main-menu-button__menu-text">Options</div>
</button>
<div class="outer-wrapper">
<div class="inner-wrapper">
<section class="intro">
<header class="title-header">
<h1>One-Dimensional Cellular Automata Playground</h1>
<h2>The Rule Set</h2>
<p class="explanation">There are eight possible arrangements of three black or white cells in a row. For each arrangement, toggle the <span class="rule-reference-highlight reference-highlight">blue highlighted</span> cell centered below it to choose whether it should be black or white. That choice is a rule, and all eight rules make a rule set that covers all possible combinations for a group of three consecutive cells. There are 256 (that's 2<sup>8</sup>) possible rule sets. (By convention, the rule sets are numbered from 0 to 255).</p>
</header>
<div class="rules-wrapper show-borders">
<div class="rule">
<div class="rule__inner">
<div class="rule__reference-row">
<div class="rule__cell on"><div class="square"></div></div>
<div class="rule__cell on"><div class="square"></div></div>
<div class="rule__cell on"><div class="square"></div></div>
</div>
<div class="rule__box">
<input id="r111" class="rule__checkbox" type="checkbox">
<label for="r111" class="rule__label square"></label>
</div>
</div>
</div>
<div class="rule">
<div class="rule__inner">
<div class="rule__reference-row">
<div class="rule__cell on"><div class="square"></div></div>
<div class="rule__cell on"><div class="square"></div></div>
<div class="rule__cell"><div class="square"></div></div>
</div>
<div class="rule__box">
<input id="r110" class="rule__checkbox" type="checkbox">
<label for="r110" class="rule__label square"></label>
</div>
</div>
</div>
<div class="rule">
<div class="rule__inner">
<div class="rule__reference-row">
<div class="rule__cell on"><div class="square"></div></div>
<div class="rule__cell"><div class="square"></div></div>
<div class="rule__cell on"><div class="square"></div></div>
</div>
<div class="rule__box">
<input id="r101" class="rule__checkbox" type="checkbox">
<label for="r101" class="rule__label square"></label>
</div>
</div>
</div>
<div class="rule">
<div class="rule__inner">
<div class="rule__reference-row">
<div class="rule__cell on"><div class="square"></div></div>
<div class="rule__cell"><div class="square"></div></div>
<div class="rule__cell"><div class="square"></div></div>
</div>
<div class="rule__box">
<input id="r100" class="rule__checkbox" type="checkbox" checked>
<label for="r100" class="rule__label square"></label>
</div>
</div>
</div>
<div class="rule">
<div class="rule__inner">
<div class="rule__reference-row">
<div class="rule__cell"><div class="square"></div></div>
<div class="rule__cell on"><div class="square"></div></div>
<div class="rule__cell on"><div class="square"></div></div>
</div>
<div class="rule__box">
<input id="r011" class="rule__checkbox" type="checkbox">
<label for="r011" class="rule__label square"></label>
</div>
</div>
</div>
<div class="rule">
<div class="rule__inner">
<div class="rule__reference-row">
<div class="rule__cell"><div class="square"></div></div>
<div class="rule__cell on"><div class="square"></div></div>
<div class="rule__cell"><div class="square"></div></div>
</div>
<div class="rule__box">
<input id="r010" class="rule__checkbox" type="checkbox">
<label for="r010" class="rule__label square"></label>
</div>
</div>
</div>
<div class="rule">
<div class="rule__inner">
<div class="rule__reference-row">
<div class="rule__cell"><div class="square"></div></div>
<div class="rule__cell"><div class="square"></div></div>
<div class="rule__cell on"><div class="square"></div></div>
</div>
<div class="rule__box">
<input id="r001" class="rule__checkbox" type="checkbox" checked>
<label for="r001" class="rule__label square"></label>
</div>
</div>
</div>
<div class="rule">
<div class="rule__inner">
<div class="rule__reference-row">
<div class="rule__cell"><div class="square"></div></div>
<div class="rule__cell"><div class="square"></div></div>
<div class="rule__cell"><div class="square"></div></div>
</div>
<div class="rule__box">
<input id="r000" class="rule__checkbox" type="checkbox">
<label for="r000" class="rule__label square"></label>
</div>
</div>
</div>
</div>
<div class="numeric-input-wrapper">
<div class="numeric-input-group numeric-input-group--wider">
<input id="rule-number-numeric" class="numeric-input" type="number" min="0" max="255" value="18" required title="Enter an integer between 0 and 255" pattern="\d{1,3}"
><button class="minus-button" data-direction="decrement">
<svg viewBox="0 0 100 100">
<rect x="12.5" y="46" width="75" height="8"/>
</svg>
</button
><button class="plus-button" data-direction="increment">
<svg viewBox="0 0 100 100">
<polygon points="87.5,46 54,46 54,12.5 46,12.5 46,46 12.5,46 12.5,54 46,54 46,87.5 54,87.5 54,54 87.5,54 "/>
</svg>
</button
><div class="numeric-input-text">
<label for="rule-number-numeric">Rule Set Number</label
><span class="mirror-rule-name">
(Mirror of
<button class="mirror-rule-button borderless-button">Rule Set
<span class="mirror-rule-name-number"></span>
</button
>)</span>
</div>
</div>
</div>
</section><!-- /intro -->
<section class="intro">
<header>
<h2>The Initial State</h2>
<p class="explanation"> The first row of <span class="initial-state-reference-highlight reference-highlight">green highlighted</span> cells represents an initial state. These are the first cells that the rule set is applied to. Click on any of them to toggle their color between black and white. It's initially set to just a single black cell, but you can create any sequence of black and white cells. Each row of cells is then generated entirely by the row just above it, according to the rule set. So the first row generates the second row, the second row generates the third row, and so on. Everything is generated entirely from the initial state and the rule set. You can't directly toggle the color of cells in the lower rows. </p>
<p class="explanation">Think of the row as a ring, with the left and right endpoints connected in a loop. Many rules create diagonal structures that wrap around the edges of the grid. Depending on the rule and the initial state, the patterns formed can be simple lines, elegant fractal geometries, or non-repeating chaotic structures. To explore the complex possibilities, view this page on a large desktop monitor, and try larger numbers (columns > 500, rows > 1000).</p>
<button class="got-it borderless-button" data-hide-instructions >Okay, got it, hide the instructions!</button>
</header>
<div class="numeric-input-wrapper">
<div class="numeric-input-group">
<input id="length" class="numeric-input" type="number" min="1" value="49" required title="Enter an integer" pattern="\d+"
><button class="minus-button" data-direction="decrement">
<svg viewBox="0 0 100 100">
<rect x="12.5" y="46" width="75" height="8"/>
</svg>
</button
><button class="plus-button" data-direction="increment">
<svg viewBox="0 0 100 100">
<polygon points="87.5,46 54,46 54,12.5 46,12.5 46,46 12.5,46 12.5,54 46,54 46,87.5 54,87.5 54,54 87.5,54 "/>
</svg>
</button
><label for="length" class="numeric-input-text">Cells in Ring (columns)</label>
</div>
<div class="numeric-input-group">
<input id="iteration" class="numeric-input" type="number" min="1" value="100" required title="Enter a positive integer" pattern="\d+"
><button class="minus-button" data-direction="decrement">
<svg viewBox="0 0 100 100">
<rect x="12.5" y="46" width="75" height="8"/>
</svg>
</button
><button class="plus-button" data-direction="increment">
<svg viewBox="0 0 100 100">
<polygon points="87.5,46 54,46 54,12.5 46,12.5 46,46 12.5,46 12.5,54 46,54 46,87.5 54,87.5 54,54 87.5,54 "/>
</svg>
</button
><label for="iteration" class="numeric-input-text">Iterations (rows)</label>
</div>
</div>
</section>
<div id="grid-group" class="grid-group limit-grid-width">
<div id="initial-state" class="initial-state show-borders"
><div class="c"><input id="init0" class="init__checkbox" type="checkbox"><label for="init0" class="init__label square"></label></div><div class="c"><input id="init1" class="init__checkbox" type="checkbox"><label for="init1" class="init__label square"></label></div><div class="c"><input id="init2" class="init__checkbox" type="checkbox"><label for="init2" class="init__label square"></label></div><div class="c"><input id="init3" class="init__checkbox" type="checkbox"><label for="init3" class="init__label square"></label></div><div class="c"><input id="init4" class="init__checkbox" type="checkbox"><label for="init4" class="init__label square"></label></div><div class="c"><input id="init5" class="init__checkbox" type="checkbox"><label for="init5" class="init__label square"></label></div><div class="c"><input id="init6" class="init__checkbox" type="checkbox"><label for="init6" class="init__label square"></label></div><div class="c"><input id="init7" class="init__checkbox" type="checkbox"><label for="init7" class="init__label square"></label></div><div class="c"><input id="init8" class="init__checkbox" type="checkbox"><label for="init8" class="init__label square"></label></div><div class="c"><input id="init9" class="init__checkbox" type="checkbox"><label for="init9" class="init__label square"></label></div><div class="c"><input id="init10" class="init__checkbox" type="checkbox"><label for="init10" class="init__label square"></label></div><div class="c"><input id="init11" class="init__checkbox" type="checkbox"><label for="init11" class="init__label square"></label></div><div class="c"><input id="init12" class="init__checkbox" type="checkbox"><label for="init12" class="init__label square"></label></div><div class="c"><input id="init13" class="init__checkbox" type="checkbox"><label for="init13" class="init__label square"></label></div><div class="c"><input id="init14" class="init__checkbox" type="checkbox"><label for="init14" class="init__label square"></label></div><div class="c"><input id="init15" class="init__checkbox" type="checkbox"><label for="init15" class="init__label square"></label></div><div class="c"><input id="init16" class="init__checkbox" type="checkbox"><label for="init16" class="init__label square"></label></div><div class="c"><input id="init17" class="init__checkbox" type="checkbox"><label for="init17" class="init__label square"></label></div><div class="c"><input id="init18" class="init__checkbox" type="checkbox"><label for="init18" class="init__label square"></label></div><div class="c"><input id="init19" class="init__checkbox" type="checkbox"><label for="init19" class="init__label square"></label></div><div class="c"><input id="init20" class="init__checkbox" type="checkbox"><label for="init20" class="init__label square"></label></div><div class="c"><input id="init21" class="init__checkbox" type="checkbox"><label for="init21" class="init__label square"></label></div><div class="c"><input id="init22" class="init__checkbox" type="checkbox"><label for="init22" class="init__label square"></label></div><div class="c"><input id="init23" class="init__checkbox" type="checkbox"><label for="init23" class="init__label square"></label></div><div class="c"><input id="init24" class="init__checkbox" type="checkbox" checked><label for="init24" class="init__label square"></label></div><div class="c"><input id="init25" class="init__checkbox" type="checkbox"><label for="init25" class="init__label square"></label></div><div class="c"><input id="init26" class="init__checkbox" type="checkbox"><label for="init26" class="init__label square"></label></div><div class="c"><input id="init27" class="init__checkbox" type="checkbox"><label for="init27" class="init__label square"></label></div><div class="c"><input id="init28" class="init__checkbox" type="checkbox"><label for="init28" class="init__label square"></label></div><div class="c"><input id="init29" class="init__checkbox" type="checkbox"><label for="init29" class="init__label square"></label></div><div class="c"><input id="init30" class="init__checkbox" type="checkbox"><label for="init30" class="init__label square"></label></div><div class="c"><input id="init31" class="init__checkbox" type="checkbox"><label for="init31" class="init__label square"></label></div><div class="c"><input id="init32" class="init__checkbox" type="checkbox"><label for="init32" class="init__label square"></label></div><div class="c"><input id="init33" class="init__checkbox" type="checkbox"><label for="init33" class="init__label square"></label></div><div class="c"><input id="init34" class="init__checkbox" type="checkbox"><label for="init34" class="init__label square"></label></div><div class="c"><input id="init35" class="init__checkbox" type="checkbox"><label for="init35" class="init__label square"></label></div><div class="c"><input id="init36" class="init__checkbox" type="checkbox"><label for="init36" class="init__label square"></label></div><div class="c"><input id="init37" class="init__checkbox" type="checkbox"><label for="init37" class="init__label square"></label></div><div class="c"><input id="init38" class="init__checkbox" type="checkbox"><label for="init38" class="init__label square"></label></div><div class="c"><input id="init39" class="init__checkbox" type="checkbox"><label for="init39" class="init__label square"></label></div><div class="c"><input id="init40" class="init__checkbox" type="checkbox"><label for="init40" class="init__label square"></label></div><div class="c"><input id="init41" class="init__checkbox" type="checkbox"><label for="init41" class="init__label square"></label></div><div class="c"><input id="init42" class="init__checkbox" type="checkbox"><label for="init42" class="init__label square"></label></div><div class="c"><input id="init43" class="init__checkbox" type="checkbox"><label for="init43" class="init__label square"></label></div><div class="c"><input id="init44" class="init__checkbox" type="checkbox"><label for="init44" class="init__label square"></label></div><div class="c"><input id="init45" class="init__checkbox" type="checkbox"><label for="init45" class="init__label square"></label></div><div class="c"><input id="init46" class="init__checkbox" type="checkbox"><label for="init46" class="init__label square"></label></div><div class="c"><input id="init47" class="init__checkbox" type="checkbox"><label for="init47" class="init__label square"></label></div><div class="c"><input id="init48" class="init__checkbox" type="checkbox"><label for="init48" class="init__label square"></label></div></div>
<div class="grid-group__canvases show-borders">
<canvas id="c" class="c-generated"></canvas>
<canvas id="c-inner-borders" class="c-inner-borders"></canvas>
</div>
</div><!-- / grid-group -->
</div><!-- / inner-wrapper -->
<div class="mobile-overlay"></div>
</div><!-- / outer-wrapper -->
<div class="options-column">
<button class="hide-options-button" data-hide-menu
><svg class="hide-options-button-svg" viewBox="0 0 100 100">
<polygon points="73,68.6 54.4,50 73,31.4 68.6,27 50,45.6 31.4,27 27,31.4 45.6,50 27,68.6 31.4,73 50,54.4 68.6,73 "/>
</svg>
</button>
<button class="borderless-button show-instructions-button" data-show-instructions >instructions</button>
<div class="go-to-rule-group">
<h3>Rules of Special Interest</h3>
<button class="borderless-button" data-go-to-rule="18">Rule 18</button><br>
<button class="borderless-button" data-go-to-rule="22">Rule 22</button><br>
<button class="borderless-button" data-go-to-rule="30">Rule 30</button><br>
<button class="borderless-button" data-go-to-rule="45">Rule 45</button><br>
<button class="borderless-button" data-go-to-rule="50">Rule 50</button><br>
<button class="borderless-button" data-go-to-rule="54">Rule 54</button><br>
<button class="borderless-button" data-go-to-rule="57">Rule 57</button><br>
<button class="borderless-button" data-go-to-rule="60">Rule 60</button><br>
<button class="borderless-button" data-go-to-rule="73">Rule 73</button><br>
<button class="borderless-button" data-go-to-rule="89">Rule 89</button><br>
<button class="borderless-button" data-go-to-rule="105">Rule 105</button><br>
<button class="borderless-button" data-go-to-rule="110">Rule 110</button><br>
<button class="borderless-button" data-go-to-rule="150">Rule 150</button><br>
<button class="borderless-button" data-go-to-rule="225">Rule 225</button><br>
</div>
<div class="checkbox-options-group">
<div class="checkbox-option"
><input type="checkbox" id="show-init-borders" class="stylish-checkbox" checked
><label for="show-init-borders"></label
><span class="stylish-checkbox__text">Show cell borders on initial state</span
></div>
<div class="checkbox-option"
><input type="checkbox" id="show-gen-borders" class="stylish-checkbox" checked
><label for="show-gen-borders"></label
><span class="stylish-checkbox__text">Show cell borders on generated</span
></div>
<div class="checkbox-option limit-width-option"
><input type="checkbox" id="limit-grid" class="stylish-checkbox" checked
><label for="limit-grid"></label
><span class="stylish-checkbox__text">Limit grid width</span
></div>
<div class="checkbox-option"
><input type="checkbox" id="url-hash" class="stylish-checkbox"
><label for="url-hash"></label
><span class="stylish-checkbox__text">Shareable URLs</span
></div>
</div>
<a class="options-column__external-link" target="_blank" href="http://en.wikipedia.org/wiki/Cellular_automaton">Wiki</a>
<a class="options-column__external-link" target="_blank" href="http://www.wolframscience.com/nks/p51--the-search-for-general-features/">Wolfram on 1-D automata</a>
<a class="options-column__external-link" target="_blank" href="https://github.com/albell/cellular-automata-playground">Source code</a>
<a class="options-column__external-link made-by" target="_blank" href="http://bellandwhistle.net">Made by Alex Bell</a>
</div>
<script
src="https://code.jquery.com/jquery-3.3.1.min.js"
integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8="
crossorigin="anonymous"></script>
<script>window.jQuery || document.write('<script src="js/min/jquery-3.3.1.min.js"><\/script>')</script>
<script src="js/min/c-a-min.js"></script>
</body>
</html>