Regenerate JavaScript using version 1.1 of ALPACA compiler.
Chris Pressey
7 months ago
1 | 1 | * This file was AUTOMATICALLY generated from an ALPACA description. |
2 | 2 | * EDIT AT YOUR OWN RISK! |
3 | 3 | */ |
4 | ||
5 | 4 | |
6 | 5 | function in_nbhd_pred(pf, x, y, pred, nbhd) { |
7 | 6 | var count = 0; |
22 | 21 | } |
23 | 22 | function loadMapper(c) { |
24 | 23 | if (c === ' ') return 'Air'; |
24 | if (c === '~') return 'Water'; | |
25 | if (c === '%') return 'Fire'; | |
25 | 26 | if (c === '#') return 'Earth'; |
26 | if (c === '%') return 'Fire'; | |
27 | 27 | if (c === '&') return 'Magma'; |
28 | if (c === 's') return 'Steam'; | |
29 | if (c === '@') return 'Smoke'; | |
30 | if (c === 'o') return 'Bubble'; | |
31 | if (c === 'f') return 'Fish'; | |
32 | if (c === '.') return 'OnePebble'; | |
33 | if (c === ':') return 'TwoPebble'; | |
28 | 34 | if (c === '*') return 'Spark'; |
29 | 35 | if (c === '-') return 'Tail'; |
30 | if (c === '.') return 'OnePebble'; | |
31 | if (c === ':') return 'TwoPebble'; | |
32 | 36 | if (c === '=') return 'Wire'; |
33 | if (c === '<') return 'ConveyorLeft'; | |
34 | if (c === '?') return 'Randomizer'; | |
35 | if (c === '>') return 'ConveyorRight'; | |
36 | if (c === '@') return 'Smoke'; | |
37 | 37 | if (c === 'D') return 'DuctTape'; |
38 | 38 | if (c === 'O') return 'UnravelTape'; |
39 | if (c === 'l') return 'Twig'; | |
40 | if (c === 'z') return 'Zappy'; | |
41 | if (c === 'Z') return 'BigZappy'; | |
42 | if (c === '?') return 'Randomizer'; | |
43 | if (c === '<') return 'ConveyorLeft'; | |
44 | if (c === '>') return 'ConveyorRight'; | |
39 | 45 | if (c === 'T') return 'Torch'; |
40 | if (c === 'Z') return 'BigZappy'; | |
41 | if (c === 'f') return 'Fish'; | |
42 | if (c === 'l') return 'Twig'; | |
43 | if (c === 'o') return 'Bubble'; | |
44 | if (c === 's') return 'Steam'; | |
45 | if (c === 'z') return 'Zappy'; | |
46 | if (c === '~') return 'Water'; | |
47 | 46 | }; |
48 | 47 | function dumpMapper(s) { |
49 | 48 | if (s === 'Air') return ' '; |
49 | if (s === 'Water') return '~'; | |
50 | if (s === 'Fire') return '%'; | |
50 | 51 | if (s === 'Earth') return '#'; |
51 | if (s === 'Fire') return '%'; | |
52 | 52 | if (s === 'Magma') return '&'; |
53 | if (s === 'Steam') return 's'; | |
54 | if (s === 'Smoke') return '@'; | |
55 | if (s === 'Bubble') return 'o'; | |
56 | if (s === 'Fish') return 'f'; | |
57 | if (s === 'OnePebble') return '.'; | |
58 | if (s === 'TwoPebble') return ':'; | |
53 | 59 | if (s === 'Spark') return '*'; |
54 | 60 | if (s === 'Tail') return '-'; |
55 | if (s === 'OnePebble') return '.'; | |
56 | if (s === 'TwoPebble') return ':'; | |
57 | 61 | if (s === 'Wire') return '='; |
58 | if (s === 'ConveyorLeft') return '<'; | |
59 | if (s === 'Randomizer') return '?'; | |
60 | if (s === 'ConveyorRight') return '>'; | |
61 | if (s === 'Smoke') return '@'; | |
62 | 62 | if (s === 'DuctTape') return 'D'; |
63 | 63 | if (s === 'UnravelTape') return 'O'; |
64 | if (s === 'Twig') return 'l'; | |
65 | if (s === 'Zappy') return 'z'; | |
66 | if (s === 'BigZappy') return 'Z'; | |
67 | if (s === 'Randomizer') return '?'; | |
68 | if (s === 'ConveyorLeft') return '<'; | |
69 | if (s === 'ConveyorRight') return '>'; | |
64 | 70 | if (s === 'Torch') return 'T'; |
65 | if (s === 'BigZappy') return 'Z'; | |
66 | if (s === 'Fish') return 'f'; | |
67 | if (s === 'Twig') return 'l'; | |
68 | if (s === 'Bubble') return 'o'; | |
69 | if (s === 'Steam') return 's'; | |
70 | if (s === 'Zappy') return 'z'; | |
71 | if (s === 'Water') return '~'; | |
72 | 71 | }; |
72 | function is_Fallable(st) { | |
73 | return (st === 'Twig') || (st === 'TwoPebble') || (st === 'OnePebble') || (st === 'UnravelTape') || 0; | |
74 | } | |
75 | ||
73 | 76 | function is_Passthru(st) { |
74 | return (st === 'Fire') || (st === 'Zappy') || (st === 'BigZappy') || (st === 'Air') || (st === 'Water') || (st === 'Smoke') || (st === 'Bubble') || (st === 'Steam') || 0; | |
77 | return (st === 'Steam') || (st === 'Bubble') || (st === 'Fire') || (st === 'Air') || (st === 'BigZappy') || (st === 'Smoke') || (st === 'Water') || (st === 'Zappy') || 0; | |
75 | 78 | } |
76 | 79 | |
77 | 80 | function is_Flammable(st) { |
78 | return (st === 'UnravelTape') || (st === 'Twig') || (st === 'DuctTape') || 0; | |
79 | } | |
80 | ||
81 | function is_Support(st) { | |
82 | return (st === 'Wire') || (st === 'DuctTape') || (st === 'Randomizer') || (st === 'TwoPebble') || (st === 'Magma') || (st === 'Tail') || (st === 'Earth') || (st === 'Spark') || (st === 'Twig') || 0; | |
83 | } | |
84 | ||
85 | function is_Burner(st) { | |
86 | return (st === 'Fire') || (st === 'Zappy') || (st === 'Spark') || (st === 'Magma') || (st === 'BigZappy') || 0; | |
81 | return (st === 'Twig') || (st === 'DuctTape') || (st === 'UnravelTape') || 0; | |
87 | 82 | } |
88 | 83 | |
89 | 84 | function is_Steamy(st) { |
90 | 85 | return (st === 'Bubble') || (st === 'Steam') || (st === 'Smoke') || 0; |
91 | 86 | } |
92 | 87 | |
93 | function is_Fallable(st) { | |
94 | return (st === 'UnravelTape') || (st === 'OnePebble') || (st === 'TwoPebble') || (st === 'Twig') || 0; | |
95 | } | |
96 | ||
97 | function evalClass_Fallable(pf, x, y) { | |
98 | var id; | |
88 | function is_Burner(st) { | |
89 | return (st === 'Fire') || (st === 'BigZappy') || (st === 'Spark') || (st === 'Magma') || (st === 'Zappy') || 0; | |
90 | } | |
91 | ||
92 | function is_Support(st) { | |
93 | return (st === 'Twig') || (st === 'Wire') || (st === 'DuctTape') || (st === 'Tail') || (st === 'Randomizer') || (st === 'Earth') || (st === 'Spark') || (st === 'Magma') || (st === 'TwoPebble') || 0; | |
94 | } | |
95 | ||
96 | function evalClass_Fallable(pf, x, y, seen) { | |
97 | var id; | |
98 | seen['Fallable'] = true; | |
99 | 99 | if (((!(is_Support(pf.get(x+0,y+1)))&&(in_nbhd_eq(pf, x, y, 'Air', [[0,-1],[0,1],[-1,0],[-1,1],[-1,-1],[1,0],[1,1],[1,-1]]) >= 2))&&!((in_nbhd_eq(pf, x, y, 'DuctTape', [[0,-1],[0,1],[-1,0],[-1,1],[-1,-1],[1,0],[1,1],[1,-1]]) >= 1)))) { |
100 | 100 | return 'Air'; |
101 | 101 | } |
108 | 108 | return undefined; |
109 | 109 | } |
110 | 110 | |
111 | function evalClass_Passthru(pf, x, y) { | |
112 | var id; | |
111 | function evalClass_Passthru(pf, x, y, seen) { | |
112 | var id; | |
113 | seen['Passthru'] = true; | |
113 | 114 | if (is_Fallable(pf.get(x+0,y+-1))) { |
114 | 115 | return pf.get(x+0,y+-1); |
115 | 116 | } |
122 | 123 | return undefined; |
123 | 124 | } |
124 | 125 | |
125 | function evalClass_Flammable(pf, x, y) { | |
126 | var id; | |
126 | function evalClass_Flammable(pf, x, y, seen) { | |
127 | var id; | |
128 | seen['Flammable'] = true; | |
127 | 129 | if ((in_nbhd_pred(pf, x, y, is_Burner, [[0,-1],[0,1],[-1,0],[-1,1],[-1,-1],[1,0],[1,1],[1,-1]]) >= 1)) { |
128 | 130 | return 'Fire'; |
129 | 131 | } |
130 | 132 | return undefined; |
131 | 133 | } |
132 | 134 | |
133 | function evalClass_Steamy(pf, x, y) { | |
134 | var id; | |
135 | function evalClass_Steamy(pf, x, y, seen) { | |
136 | var id; | |
137 | seen['Steamy'] = true; | |
135 | 138 | if ((((((pf.get(x+-1,y+0)==='Water')||(pf.get(x+1,y+0)==='Water'))||(pf.get(x+-1,y+-1)==='Water'))||(pf.get(x+1,y+-1)==='Water'))||(pf.get(x+0,y+-1)==='Water'))) { |
136 | 139 | return 'Water'; |
137 | 140 | } |
141 | 144 | return undefined; |
142 | 145 | } |
143 | 146 | |
144 | function evalClass_Burner(pf, x, y) { | |
145 | var id; | |
146 | return undefined; | |
147 | } | |
148 | ||
149 | function evalClass_Support(pf, x, y) { | |
150 | var id; | |
147 | function evalClass_Burner(pf, x, y, seen) { | |
148 | var id; | |
149 | seen['Burner'] = true; | |
150 | return undefined; | |
151 | } | |
152 | ||
153 | function evalClass_Support(pf, x, y, seen) { | |
154 | var id; | |
155 | seen['Support'] = true; | |
151 | 156 | return undefined; |
152 | 157 | } |
153 | 158 | |
165 | 170 | if ((in_nbhd_eq(pf, x, y, 'Spark', [[0,-1],[0,1],[-1,0],[-1,1],[-1,-1],[1,0],[1,1],[1,-1]]) >= 1)) { |
166 | 171 | return 'Zappy'; |
167 | 172 | } |
168 | id = evalClass_Passthru(pf, x, y); | |
173 | id = evalClass_Passthru(pf, x, y, {}); | |
169 | 174 | if (id !== undefined) return id; |
170 | 175 | return 'Air'; |
171 | 176 | } |
181 | 186 | if (((in_nbhd_eq(pf, x, y, 'Fish', [[0,-1],[0,1],[-1,0],[-1,1],[-1,-1],[1,0],[1,1],[1,-1]]) >= 3)&&(in_nbhd_eq(pf, x, y, 'Water', [[0,-1],[0,1],[-1,0],[-1,1],[-1,-1],[1,0],[1,1],[1,-1]]) >= 5))) { |
182 | 187 | return 'Fish'; |
183 | 188 | } |
184 | id = evalClass_Passthru(pf, x, y); | |
189 | id = evalClass_Passthru(pf, x, y, {}); | |
185 | 190 | if (id !== undefined) return id; |
186 | 191 | return 'Water'; |
187 | 192 | } |
191 | 196 | if ((((in_nbhd_eq(pf, x, y, 'Water', [[0,-1],[0,1],[-1,0],[-1,1],[-1,-1],[1,0],[1,1],[1,-1]]) >= 1)||!((in_nbhd_eq(pf, x, y, 'Air', [[0,-1],[0,1],[-1,0],[-1,1],[-1,-1],[1,0],[1,1],[1,-1]]) >= 1)))||((!((in_nbhd_eq(pf, x, y, 'Torch', [[0,-1],[0,1],[-1,0],[-1,1],[-1,-1],[1,0],[1,1],[1,-1]]) >= 1))&&!((in_nbhd_eq(pf, x, y, 'DuctTape', [[0,-1],[0,1],[-1,0],[-1,1],[-1,-1],[1,0],[1,1],[1,-1]]) >= 1)))&&!((in_nbhd_eq(pf, x, y, 'Twig', [[0,-1],[0,1],[-1,0],[-1,1],[-1,-1],[1,0],[1,1],[1,-1]]) >= 1))))) { |
192 | 197 | return 'Smoke'; |
193 | 198 | } |
194 | id = evalClass_Passthru(pf, x, y); | |
195 | if (id !== undefined) return id; | |
196 | id = evalClass_Burner(pf, x, y); | |
199 | id = evalClass_Passthru(pf, x, y, {}); | |
200 | if (id !== undefined) return id; | |
201 | id = evalClass_Burner(pf, x, y, {}); | |
197 | 202 | if (id !== undefined) return id; |
198 | 203 | return 'Fire'; |
199 | 204 | } |
203 | 208 | if ((in_nbhd_eq(pf, x, y, 'Fire', [[0,-1],[0,1],[-1,0],[-1,1],[-1,-1],[1,0],[1,1],[1,-1]]) >= 1)) { |
204 | 209 | return 'Magma'; |
205 | 210 | } |
206 | id = evalClass_Support(pf, x, y); | |
211 | id = evalClass_Support(pf, x, y, {}); | |
207 | 212 | if (id !== undefined) return id; |
208 | 213 | return 'Earth'; |
209 | 214 | } |
213 | 218 | if ((!((in_nbhd_eq(pf, x, y, 'Fire', [[0,-1],[0,1],[-1,0],[-1,1],[-1,-1],[1,0],[1,1],[1,-1]]) >= 1))&&!((in_nbhd_eq(pf, x, y, 'Magma', [[0,-1],[0,1],[-1,0],[-1,1],[-1,-1],[1,0],[1,1],[1,-1]]) >= 2)))) { |
214 | 219 | return 'Earth'; |
215 | 220 | } |
216 | id = evalClass_Support(pf, x, y); | |
217 | if (id !== undefined) return id; | |
218 | id = evalClass_Burner(pf, x, y); | |
221 | id = evalClass_Support(pf, x, y, {}); | |
222 | if (id !== undefined) return id; | |
223 | id = evalClass_Burner(pf, x, y, {}); | |
219 | 224 | if (id !== undefined) return id; |
220 | 225 | return 'Magma'; |
221 | 226 | } |
222 | 227 | |
223 | 228 | function eval_Steam(pf, x, y) { |
224 | 229 | var id; |
225 | id = evalClass_Passthru(pf, x, y); | |
226 | if (id !== undefined) return id; | |
227 | id = evalClass_Steamy(pf, x, y); | |
230 | id = evalClass_Passthru(pf, x, y, {}); | |
231 | if (id !== undefined) return id; | |
232 | id = evalClass_Steamy(pf, x, y, {}); | |
228 | 233 | if (id !== undefined) return id; |
229 | 234 | return 'Steam'; |
230 | 235 | } |
231 | 236 | |
232 | 237 | function eval_Smoke(pf, x, y) { |
233 | 238 | var id; |
234 | id = evalClass_Passthru(pf, x, y); | |
235 | if (id !== undefined) return id; | |
236 | id = evalClass_Steamy(pf, x, y); | |
239 | id = evalClass_Passthru(pf, x, y, {}); | |
240 | if (id !== undefined) return id; | |
241 | id = evalClass_Steamy(pf, x, y, {}); | |
237 | 242 | if (id !== undefined) return id; |
238 | 243 | return 'Smoke'; |
239 | 244 | } |
240 | 245 | |
241 | 246 | function eval_Bubble(pf, x, y) { |
242 | 247 | var id; |
243 | id = evalClass_Passthru(pf, x, y); | |
244 | if (id !== undefined) return id; | |
245 | id = evalClass_Steamy(pf, x, y); | |
248 | id = evalClass_Passthru(pf, x, y, {}); | |
249 | if (id !== undefined) return id; | |
250 | id = evalClass_Steamy(pf, x, y, {}); | |
246 | 251 | if (id !== undefined) return id; |
247 | 252 | return 'Bubble'; |
248 | 253 | } |
263 | 268 | if (((pf.get(x+0,y+-1)==='OnePebble')&&is_Support(pf.get(x+0,y+1)))) { |
264 | 269 | return 'TwoPebble'; |
265 | 270 | } |
266 | id = evalClass_Fallable(pf, x, y); | |
271 | id = evalClass_Fallable(pf, x, y, {}); | |
267 | 272 | if (id !== undefined) return id; |
268 | 273 | return 'OnePebble'; |
269 | 274 | } |
270 | 275 | |
271 | 276 | function eval_TwoPebble(pf, x, y) { |
272 | 277 | var id; |
273 | id = evalClass_Fallable(pf, x, y); | |
274 | if (id !== undefined) return id; | |
275 | id = evalClass_Support(pf, x, y); | |
278 | id = evalClass_Fallable(pf, x, y, {}); | |
279 | if (id !== undefined) return id; | |
280 | id = evalClass_Support(pf, x, y, {}); | |
276 | 281 | if (id !== undefined) return id; |
277 | 282 | return 'TwoPebble'; |
278 | 283 | } |
282 | 287 | if (true) { |
283 | 288 | return 'Tail'; |
284 | 289 | } |
285 | id = evalClass_Support(pf, x, y); | |
286 | if (id !== undefined) return id; | |
287 | id = evalClass_Burner(pf, x, y); | |
290 | id = evalClass_Support(pf, x, y, {}); | |
291 | if (id !== undefined) return id; | |
292 | id = evalClass_Burner(pf, x, y, {}); | |
288 | 293 | if (id !== undefined) return id; |
289 | 294 | return 'Spark'; |
290 | 295 | } |
294 | 299 | if (true) { |
295 | 300 | return 'Wire'; |
296 | 301 | } |
297 | id = evalClass_Support(pf, x, y); | |
302 | id = evalClass_Support(pf, x, y, {}); | |
298 | 303 | if (id !== undefined) return id; |
299 | 304 | return 'Tail'; |
300 | 305 | } |
304 | 309 | if (((in_nbhd_eq(pf, x, y, 'Spark', [[0,-1],[0,1],[-1,0],[-1,1],[-1,-1],[1,0],[1,1],[1,-1]]) >= 1)&&!((in_nbhd_eq(pf, x, y, 'Spark', [[0,-1],[0,1],[-1,0],[-1,1],[-1,-1],[1,0],[1,1],[1,-1]]) >= 3)))) { |
305 | 310 | return 'Spark'; |
306 | 311 | } |
307 | id = evalClass_Support(pf, x, y); | |
312 | id = evalClass_Support(pf, x, y, {}); | |
308 | 313 | if (id !== undefined) return id; |
309 | 314 | return 'Wire'; |
310 | 315 | } |
314 | 319 | if ((!((in_nbhd_eq(pf, x, y, 'DuctTape', [[0,-1],[0,1],[-1,0],[-1,1],[-1,-1],[1,0],[1,1],[1,-1]]) >= 2))||!(((in_nbhd_eq(pf, x, y, 'DuctTape', [[0,-1],[0,1],[-1,0],[-1,1],[-1,-1],[1,0],[1,1],[1,-1]]) >= 1)&&(in_nbhd_pred(pf, x, y, is_Support, [[0,-1],[0,1],[-1,0],[-1,1],[-1,-1],[1,0],[1,1],[1,-1]]) >= 1))))) { |
315 | 320 | return 'UnravelTape'; |
316 | 321 | } |
317 | id = evalClass_Support(pf, x, y); | |
318 | if (id !== undefined) return id; | |
319 | id = evalClass_Flammable(pf, x, y); | |
322 | id = evalClass_Support(pf, x, y, {}); | |
323 | if (id !== undefined) return id; | |
324 | id = evalClass_Flammable(pf, x, y, {}); | |
320 | 325 | if (id !== undefined) return id; |
321 | 326 | return 'DuctTape'; |
322 | 327 | } |
323 | 328 | |
324 | 329 | function eval_UnravelTape(pf, x, y) { |
325 | 330 | var id; |
326 | id = evalClass_Fallable(pf, x, y); | |
327 | if (id !== undefined) return id; | |
328 | id = evalClass_Flammable(pf, x, y); | |
331 | id = evalClass_Fallable(pf, x, y, {}); | |
332 | if (id !== undefined) return id; | |
333 | id = evalClass_Flammable(pf, x, y, {}); | |
329 | 334 | if (id !== undefined) return id; |
330 | 335 | return 'UnravelTape'; |
331 | 336 | } |
332 | 337 | |
333 | 338 | function eval_Twig(pf, x, y) { |
334 | 339 | var id; |
335 | id = evalClass_Fallable(pf, x, y); | |
336 | if (id !== undefined) return id; | |
337 | id = evalClass_Support(pf, x, y); | |
338 | if (id !== undefined) return id; | |
339 | id = evalClass_Flammable(pf, x, y); | |
340 | id = evalClass_Fallable(pf, x, y, {}); | |
341 | if (id !== undefined) return id; | |
342 | id = evalClass_Support(pf, x, y, {}); | |
343 | if (id !== undefined) return id; | |
344 | id = evalClass_Flammable(pf, x, y, {}); | |
340 | 345 | if (id !== undefined) return id; |
341 | 346 | return 'Twig'; |
342 | 347 | } |
346 | 351 | if (true) { |
347 | 352 | return 'BigZappy'; |
348 | 353 | } |
349 | id = evalClass_Passthru(pf, x, y); | |
350 | if (id !== undefined) return id; | |
351 | id = evalClass_Burner(pf, x, y); | |
354 | id = evalClass_Passthru(pf, x, y, {}); | |
355 | if (id !== undefined) return id; | |
356 | id = evalClass_Burner(pf, x, y, {}); | |
352 | 357 | if (id !== undefined) return id; |
353 | 358 | return 'Zappy'; |
354 | 359 | } |
358 | 363 | if (true) { |
359 | 364 | return 'Air'; |
360 | 365 | } |
361 | id = evalClass_Passthru(pf, x, y); | |
362 | if (id !== undefined) return id; | |
363 | id = evalClass_Burner(pf, x, y); | |
366 | id = evalClass_Passthru(pf, x, y, {}); | |
367 | if (id !== undefined) return id; | |
368 | id = evalClass_Burner(pf, x, y, {}); | |
364 | 369 | if (id !== undefined) return id; |
365 | 370 | return 'BigZappy'; |
366 | 371 | } |
367 | 372 | |
368 | 373 | function eval_Randomizer(pf, x, y) { |
369 | 374 | var id; |
370 | id = evalClass_Support(pf, x, y); | |
375 | id = evalClass_Support(pf, x, y, {}); | |
371 | 376 | if (id !== undefined) return id; |
372 | 377 | return 'Randomizer'; |
373 | 378 | } |