-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
262 lines (261 loc) · 11.6 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8"/>
<title>OpenCA</title>
<link rel="apple-touch-icon" sizes="180x180" href="icons/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="icons/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="icons/favicon-16x16.png">
<link rel="manifest" href="icons/site.webmanifest">
<link rel="stylesheet" href="css/main.css" rel="stylesheet">
<link rel="stylesheet" href="css/bootstrap-colorpicker.min.css">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous">
</head>
<body>
<div class="container">
<div class="row mt-5 mb-4">
<div class="col-lg-12">
<h1>
<span>OpenCA</span>
<small class="text-muted">2D cellular automata simulator</small>
</h1>
</div>
</div>
<div class="row">
<div class="col-lg-7">
<div class="row">
<div class="col-sm-3">
<label for="engine-gen">
Target generation
</label>
</div>
<div class="col-sm-3">
<label for="engine-interval">
Time interval (ms)
</label>
</div>
<div class="col">
<span id="engine-status">
Ready.
</span>
</div>
</div>
<div class="row">
<div class="col-sm-3">
<input type="number" min="1" value="1" class="form-control w-100" id="engine-gen" />
</div>
<div class="col-sm-3">
<input type="number" min="1" value="1000" class="form-control w-100" id="engine-interval" />
</div>
<div class="col">
<button type="button" class="btn btn-primary" id="engine-start">
Start
</button>
<button type="button" disabled class="btn btn-primary" id="engine-stop">
Stop
</button>
<button type="button" disabled class="btn btn-danger float-right" id="engine-reset">
Reset to last start
</button>
</div>
</div>
<div class="row mt-3">
<div class="col">
<canvas id="frame"></canvas>
</div>
</div>
</div>
<div class="col-lg-4 ml-5">
<div id="main-menu">
<p class="h4 d-inline">Global settings</p>
<div class="row mt-2">
<div class="col-sm pr-1">
<label for="x-size">
Grid height
</label>
<input type="number" class="form-control" value="4" min="1" id="x-size" />
</div>
<div class="col-sm pl-1">
<label for="y-size">
Grid width
</label>
<input type="number" class="form-control" value="4" min="1" id="y-size" />
</div>
</div>
<div class="row mt-2 mb-2">
<div class="col-sm pr-1 d-flex justify-content-center">
<button type="button"
class="btn btn-block btn-primary dropdown-toggle" data-toggle="dropdown">
Boundary
</button>
<div class="dropdown-menu" id="boundary-list">
<button data="0" class="dropdown-item">Rectangle</button>
<button data="1" class="dropdown-item">Vertical cylinder</button>
<button data="2" class="dropdown-item">Horizontal cylinder</button>
<button data="3" class="dropdown-item">Torus</button>
</div>
</div>
<div class="col-sm pl-1">
<button type="button" class="btn btn-primary btn-block" id="update-grid">Update</button>
</div>
</div>
<span class="d-block">Configure states</span>
<div class="row mt-2">
<div class="col-sm pr-1">
<button type="button"
class="btn btn-block btn-primary dropdown-toggle" data-toggle="dropdown">
Edit state
</button>
<div class="dropdown-menu normal-list" id="state-list"></div>
</div>
<div class="col-sm pl-1 d-flex justify-content-between">
<button type="button" class="btn btn-block new btn-primary" id="state-add">
Add state
</button>
<button type="button" class="btn flex-fill btn-primary" id="state-edit">
Save
</button>
<button type="button" class="btn flex-fill ml-2 btn-danger" id="state-remove">
Delete
</button>
</div>
</div>
<div class="row mt-1">
<div class="col-sm pr-1 mt-1">
<label for="state-name">
State name
</label>
<input type="text" class="form-control" id="state-name" />
</div>
<div class="col-sm pl-1 mt-1">
<label class="d-block" for="state-color">
State color
</label>
<div class="input-group" id="state-color">
<input type="text" class="form-control" />
<span class="input-group-append">
<span class="input-group-text colorpicker-input-addon"><i></i></span>
</span>
</div>
</div>
</div>
<div class="border-top my-3"></div>
<p class="h4 d-inline">Cell behavior</p>
<span class="float-right mt-1" id="current-cell">Select cell</span>
<div id="cell-menu">
<div class="row mt-2 mb-2">
<div class="col-sm pr-1">
<button type="button" id="action-add" class="btn btn-block btn-primary">
Add action
</button>
</div>
<div class="col-sm pl-1">
<button type="button"
class="btn btn-block btn-primary dropdown-toggle" data-toggle="dropdown">
Set state
</button>
<div class="dropdown-menu" id="state-set"></div>
</div>
</div>
<span class="text-right d-block mt-1">Configure actions</span>
<div class="row">
<div class="col-sm">
<ul class="list-group list-group-flush" id="cell-actions"></ul>
</div>
</div>
</div>
<div class="border-top my-3"></div>
<p class="h4 d-inline">Outside world</p>
<div class="row mb-2 mt-2">
<div class="col-sm-3">
<a class="d-none" id="io-export-anchor"></a>
<button type="button" class="btn btn-primary" id="io-export">Export</button>
</div>
<div class="col-sm-9 pl-0">
<div class="input-group">
<div class="custom-file">
<input type="file" class="custom-file-input" id="io-import-file">
<label class="custom-file-label" for="io-import-file">Choose file</label>
</div>
<div class="input-group-append">
<button class="btn btn-primary" id="io-import" type="button">Import</button>
</div>
</div>
</div>
</div>
</div>
<div id="action-menu">
<span class="d-block">Select action target</span>
<div class="row mb-1 mt-1">
<div class="col-sm pr-1">
<button type="button"
class="btn btn-block btn-primary dropdown-toggle" data-toggle="dropdown">
Target
</button>
<div class="dropdown-menu normal-list" id="target-list">
<button class="dropdown-item" data="1">Single</button>
<button class="dropdown-item" data="0">Neighborhood</button>
</div>
</div>
<div class="col-sm pl-1 d-flex justify-content-center">
<span class="align-self-center" id="target-cell">Select target</span>
<input type="number" min="1" placeholder="Distance" id="target-distance" class="form-control" />
</div>
</div>
<span class="d-block">Define test mode and threshold</span>
<div class="row mb-1 mt-1">
<div class="col-sm pr-1">
<button type="button"
class="btn btn-block btn-primary dropdown-toggle" data-toggle="dropdown">
Mode
</button>
<div class="dropdown-menu normal-list" id="mode-list">
<button data="0" class="dropdown-item">Equals to</button>
<button data="1" class="dropdown-item">Differs from</button>
<button data="2" class="dropdown-item" disabled>Less than</button>
<button data="3" class="dropdown-item" disabled>More than</button>
</div>
</div>
<div class="col-sm pl-1">
<input type="number" min="0" disabled placeholder="Threshold" id="action-thresh" class="form-control" />
</div>
</div>
<span class="d-block">Choose test state and the new one for this cell.</span>
<div class="row mb-2 mt-1">
<div class="col-sm pr-1">
<button type="button"
class="btn btn-block btn-primary dropdown-toggle" data-toggle="dropdown">
Test state
</button>
<div class="dropdown-menu normal-list" id="test-state-list"></div>
</div>
<div class="col-sm pl-1">
<button type="button"
class="btn btn-block btn-primary dropdown-toggle" data-toggle="dropdown">
New state
</button>
<div class="dropdown-menu normal-list" id="new-state-list"></div>
</div>
</div>
<div class="row">
<div class="col-sm pr-1"></div>
<div class="col-sm pl-1 d-flex">
<button type="button" class="btn flex-fill btn-primary" id="action-apply">
Save
</button>
<button type="button" class="btn flex-fill btn-danger ml-2" id="action-cancel">
Cancel
</button>
</div>
</div>
</div>
</div>
</div>
</div>
<script src="https://code.jquery.com/jquery-3.4.1.slim.min.js" integrity="sha384-J6qa4849blE2+poT4WnyKhv5vZF5SrPo0iEjwBvKU7imGFAV0wwj1yYfoRSJoZ+n" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js" integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js" integrity="sha384-wfSDF2E50Y2D1uUdj0O3uMBJnjuUD4Ih7YwaYd1iqfktj0Uod8GCExl3Og8ifwB6" crossorigin="anonymous"></script>
<script src="javascript/lib/bootstrap-colorpicker.min.js" type="text/javascript"/></script>
<script src="javascript/main.js" type="module"/></script>
</body>
</html>