-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
312 lines (261 loc) · 9.58 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Automaton Lab</title>
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.0.12/css/all.css" integrity="sha384-G0fIWCsCzJIMAVNQPfjH08cyYaUtMwjJwqiRKxxE/rx96Uroj1BtIQ6MLJuheaO9" crossorigin="anonymous">
<style>
:root {
--tile-size: 13px;
--component-background-color: #212020;
--component-border-light: 1px solid #383737;
--component-border-dark: 1px solid black;
--toolbar-width: 40px;
--toolbar-button-width: 50px;
--toolbar-button-height: 40px;
--flex-first-column: 1;
--flex-second-column: 4;
}
body {
margin: 0;
padding: 0;
box-sizing: border-box;
background-color: black;
color: white;
font-family: sans-serif;
font-weight: normal;
}
h1 {
margin: 10px;
color: #e0e0e0;
}
textarea {
font-family: monospace;
background-color: var(--component-background-color);
color: white;
border-bottom: var(--component-border-light);
border-top: var(--component-border-dark);
border-left: 0;
border-right: var(--component-border-dark);
resize: none;
}
input[type="number"] {
background-color: #101010;
color: white;
}
.button {
border-radius: 4px;
font-weight: bold;
background-color: #a7a7a7;
}
.button:focus {
outline: 0;
}
button.button:active {
position: relative;
top: 2px;
left: 2px;
}
.hidden {
display: none !important;
}
.container-vertical {
display: flex;
flex-direction: column;
}
#main-container {
position: fixed;
height: 100%;
width: 100%;
}
.header {
flex: 0 0 content;
display: flex;
justify-content: flex-start;
align-items: stretch;
background-color: var(--component-background-color);
}
.title {
flex: var(--flex-first-column) 0 0;
display: flex;
flex-direction: row;
justify-content: left;
align-items: center;
}
.header-buttons {
flex: var(--flex-second-column) 0 0;
display: flex;
flex-direction: row;
justify-content: left;
align-items: center;
}
.header-buttons button {
width: var(--toolbar-button-width);
height: var(--toolbar-button-height);
font-size: 22px;
margin-left: 5px;
text-align: center;
padding-top: 5px;
}
.header-buttons input[type="radio"] {
display: none;
}
.header-buttons input[type="radio"]:checked + label {
background-color: #717171;
border: 2px inset buttonface;
}
.button-group {
display: flex;
flex-direction: row;
}
.button-group input[type="radio"] + label {
color: buttontext;
border-image: initial;
width: var(--toolbar-button-width);
height: var(--toolbar-button-height);
box-sizing: border-box;
border-right: 0;
border-left: 0;
border-radius: 0;
border-top: 2px outset buttonface;
border-bottom: 2px outset buttonface;
display: flex;
justify-content: center;
align-items: center;
}
.button-group input[type="radio"]:first-child + label {
border-left: 2px outset buttonface;
border-top-left-radius: 4px;
border-bottom-left-radius: 4px;
}
.button-group input[type="radio"] + label:last-child {
border-right: 2px outset buttonface;
border-top-right-radius: 4px;
border-bottom-right-radius: 4px;
}
.header-buttons .spacer {
--width: calc(var(--toolbar-button-width) / 2);
--line-size: 1px;
width: 0;
margin: 0 calc(var(--width) / 2) 0 calc(var(--width) / 2 + 5px - var(--line-size) / 2);
height: var(--toolbar-button-height);
border-left: var(--line-size) solid black;
border-right: var(--line-size) solid #353535;
}
.footer {
flex: 0 0 auto;
padding: 10px;
border-top: var(--component-border-light);
background-color: var(--component-background-color);
}
.valid {
color: lime;
margin-right: 10px;
}
.invalid {
color: red;
margin-right: 10px;
}
.container-horizontal {
flex: 1 1 auto;
display: flex;
flex-direction: row;
}
#rules-script {
flex: var(--flex-first-column) 0 0;
color: #799466;
}
#map-container {
flex: var(--flex-second-column) 0 0;
display: flex;
justify-content: center;
align-items: center;
user-select: none; /* so that we can click and drag freely when editing the map */
}
#map-table {
font-family: sans-serif;
font-size: 24px;
border-spacing: 1px;
background-color: #151414;
cursor: crosshair;
}
#map-table td {
background-color: #101010;
width: var(--tile-size);
height: var(--tile-size);
text-align: center;
vertical-align: middle;
}
#map-table td.wall {
background-color: #575757;
}
#map-table td.water {
background-color: blue;
color: #9ed0ff;
}
#new-map-size-helper {
width: 200px;
height: 100px;
background-color: #151414;
font-family: sans-serif;
display: flex;
justify-content: center;
align-items: center;
font-size: 24px;
white-space: nowrap;
text-align: center;
}
</style>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-101273659-1', 'auto');
ga('send', 'pageview');
</script>
</head>
<body>
<div id="main-container" class="container-vertical">
<div class="header">
<div class="title">
<h1>Automaton Lab <i class="fas fa-flask"></i></h1>
</div>
<div class="header-buttons">
<button class="button" id="new-map-button" title="Create new map (hotkey: n)"><i class="far fa-file fa-1x"></i></button>
<button class="button" id="clear-map-button" title="Clear map (hotkey: x)"><i class="far fa-trash-alt"></i></button>
<button class="button" id="save-map-button" title="Save map to clipboard as text (hotkey: s)"><i class="far fa-save"></i></button>
<button class="button" id="reload-map-button" title="Reload last saved map (hotkey: r)"><i class="fas fa-sync-alt fa-1x"></i></button>
<div class="spacer"></div>
<button class="button hidden" id="play-button" title="Continue (hotkey: p)"><i class="fas fa-play fa-1x"></i></button>
<button class="button" id="pause-button" title="Pause (hotkey: p)"><i class="fas fa-pause fa-1x"></i></button>
<button class="button" id="step-button" title="Step (hotkey: o)"><i class="fas fa-step-forward"></i></button>
<div class="spacer"></div>
<button class="button" id="clear-water-button" title="Get rid of water (hotkey: z)"><i class="far fa-sun"></i></button>
<div class="spacer"></div>
<div id="brush-palette" class="button-group">
<input type="radio" id="brush-empty" name="brush" checked><label class="button" for="brush-empty" title="Empty space (hotkey: e)"></label>
<input type="radio" id="brush-wall" name="brush"><label class="button" for="brush-wall" title="Wall (hotkey: b)">#</label>
<input type="radio" id="brush-water" name="brush"><label class="button" for="brush-water" title="Water (hotkey: w)">~</label>
</div>
</div>
</div>
<div class="container-horizontal">
<textarea name="rules-script" id="rules-script" cols="30" rows="10"></textarea>
<div id="map-container">
<table id="map-table"></table>
<div id="new-map-size-helper" class="hidden"></div>
</div>
</div>
<div class="footer">
Rules:
<span id="rules-valid" class="valid hidden"><i class="fas fa-check"></i></span>
<span id="rules-invalid" class="invalid"><i class="fas fa-times"></i></span>
<span id="rules-message"></span>
</div>
</div>
</body>
<script type="text/javascript" src="utils.js"></script>
<script type="text/javascript" src="rules-parser.js"></script>
<script type="text/javascript" src="index.js"></script>
</html>