-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
72 lines (56 loc) · 2.08 KB
/
index.html
File metadata and controls
72 lines (56 loc) · 2.08 KB
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
<html>
<head>
<title>Cellular automatons</title>
<script type="text/javascript">
var checkboxes = function() {
for (var i = 0; i < 100; i++)
{
var box = document.createElement("input");
box.type = "checkbox";
box.name = "cells";
box.value = "cell"+i;
document.getElementById("checkboxes").appendChild(box);
}
}
var rules = function() {
var table = document.createElement("table");
var tr = document.createElement("tr");
for (var i = 0; i < 8; i++)
{
var td = document.createElement("td");
var text = document.createTextNode(("000" + i.toString(2)).slice(-3));
td.appendChild(text);
tr.appendChild(td);
}
var boxtr = document.createElement("tr");
for (var i = 0; i < 8; i++)
{
var boxtd = document.createElement("td");
var box = document.createElement("input");
box.type = "checkbox";
box.name = "rules";
box.value = "rule" + i;
boxtd.appendChild(box);
boxtr.appendChild(boxtd);
}
table.appendChild(tr);
table.appendChild(boxtr);
document.getElementById("rules").appendChild(table);
}
</script>
</head>
<body>
<p>Width <input type="text" id="width"></p>
<p>Iterations <input type="text" id="iter"></p>
<p id="checkboxes">Starting cells <script> checkboxes(); </script>
</p>
<p id="rules">Rules <script> rules(); </script> </p>
<p>Wrap around? <input type="checkbox" id="wraparound"></p>
<p><button type="button" id="draw">Ok</button></p>
<canvas width="800" height="800" id="canvas">
</canvas>
</div>
<script src="jquery-2.1.1.js"></script>
<script src="automaton.js"></script>
</body>
</html>