git @ Cat's Eye Technologies REDGREEN / develop-2024
Regenerate JavaScript using version 1.1 of ALPACA compiler. Chris Pressey 7 months ago
1 changed file(s) with 108 addition(s) and 103 deletion(s). Raw diff Collapse all Expand all
11 * This file was AUTOMATICALLY generated from an ALPACA description.
22 * EDIT AT YOUR OWN RISK!
33 */
4
54
65 function in_nbhd_pred(pf, x, y, pred, nbhd) {
76 var count = 0;
2221 }
2322 function loadMapper(c) {
2423 if (c === ' ') return 'Air';
24 if (c === '~') return 'Water';
25 if (c === '%') return 'Fire';
2526 if (c === '#') return 'Earth';
26 if (c === '%') return 'Fire';
2727 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';
2834 if (c === '*') return 'Spark';
2935 if (c === '-') return 'Tail';
30 if (c === '.') return 'OnePebble';
31 if (c === ':') return 'TwoPebble';
3236 if (c === '=') return 'Wire';
33 if (c === '<') return 'ConveyorLeft';
34 if (c === '?') return 'Randomizer';
35 if (c === '>') return 'ConveyorRight';
36 if (c === '@') return 'Smoke';
3737 if (c === 'D') return 'DuctTape';
3838 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';
3945 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';
4746 };
4847 function dumpMapper(s) {
4948 if (s === 'Air') return ' ';
49 if (s === 'Water') return '~';
50 if (s === 'Fire') return '%';
5051 if (s === 'Earth') return '#';
51 if (s === 'Fire') return '%';
5252 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 ':';
5359 if (s === 'Spark') return '*';
5460 if (s === 'Tail') return '-';
55 if (s === 'OnePebble') return '.';
56 if (s === 'TwoPebble') return ':';
5761 if (s === 'Wire') return '=';
58 if (s === 'ConveyorLeft') return '<';
59 if (s === 'Randomizer') return '?';
60 if (s === 'ConveyorRight') return '>';
61 if (s === 'Smoke') return '@';
6262 if (s === 'DuctTape') return 'D';
6363 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 '>';
6470 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 '~';
7271 };
72 function is_Fallable(st) {
73 return (st === 'Twig') || (st === 'TwoPebble') || (st === 'OnePebble') || (st === 'UnravelTape') || 0;
74 }
75
7376 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;
7578 }
7679
7780 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;
8782 }
8883
8984 function is_Steamy(st) {
9085 return (st === 'Bubble') || (st === 'Steam') || (st === 'Smoke') || 0;
9186 }
9287
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;
9999 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)))) {
100100 return 'Air';
101101 }
108108 return undefined;
109109 }
110110
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;
113114 if (is_Fallable(pf.get(x+0,y+-1))) {
114115 return pf.get(x+0,y+-1);
115116 }
122123 return undefined;
123124 }
124125
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;
127129 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)) {
128130 return 'Fire';
129131 }
130132 return undefined;
131133 }
132134
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;
135138 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'))) {
136139 return 'Water';
137140 }
141144 return undefined;
142145 }
143146
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;
151156 return undefined;
152157 }
153158
165170 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)) {
166171 return 'Zappy';
167172 }
168 id = evalClass_Passthru(pf, x, y);
173 id = evalClass_Passthru(pf, x, y, {});
169174 if (id !== undefined) return id;
170175 return 'Air';
171176 }
181186 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))) {
182187 return 'Fish';
183188 }
184 id = evalClass_Passthru(pf, x, y);
189 id = evalClass_Passthru(pf, x, y, {});
185190 if (id !== undefined) return id;
186191 return 'Water';
187192 }
191196 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))))) {
192197 return 'Smoke';
193198 }
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, {});
197202 if (id !== undefined) return id;
198203 return 'Fire';
199204 }
203208 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)) {
204209 return 'Magma';
205210 }
206 id = evalClass_Support(pf, x, y);
211 id = evalClass_Support(pf, x, y, {});
207212 if (id !== undefined) return id;
208213 return 'Earth';
209214 }
213218 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)))) {
214219 return 'Earth';
215220 }
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, {});
219224 if (id !== undefined) return id;
220225 return 'Magma';
221226 }
222227
223228 function eval_Steam(pf, x, y) {
224229 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, {});
228233 if (id !== undefined) return id;
229234 return 'Steam';
230235 }
231236
232237 function eval_Smoke(pf, x, y) {
233238 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, {});
237242 if (id !== undefined) return id;
238243 return 'Smoke';
239244 }
240245
241246 function eval_Bubble(pf, x, y) {
242247 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, {});
246251 if (id !== undefined) return id;
247252 return 'Bubble';
248253 }
263268 if (((pf.get(x+0,y+-1)==='OnePebble')&&is_Support(pf.get(x+0,y+1)))) {
264269 return 'TwoPebble';
265270 }
266 id = evalClass_Fallable(pf, x, y);
271 id = evalClass_Fallable(pf, x, y, {});
267272 if (id !== undefined) return id;
268273 return 'OnePebble';
269274 }
270275
271276 function eval_TwoPebble(pf, x, y) {
272277 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, {});
276281 if (id !== undefined) return id;
277282 return 'TwoPebble';
278283 }
282287 if (true) {
283288 return 'Tail';
284289 }
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, {});
288293 if (id !== undefined) return id;
289294 return 'Spark';
290295 }
294299 if (true) {
295300 return 'Wire';
296301 }
297 id = evalClass_Support(pf, x, y);
302 id = evalClass_Support(pf, x, y, {});
298303 if (id !== undefined) return id;
299304 return 'Tail';
300305 }
304309 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)))) {
305310 return 'Spark';
306311 }
307 id = evalClass_Support(pf, x, y);
312 id = evalClass_Support(pf, x, y, {});
308313 if (id !== undefined) return id;
309314 return 'Wire';
310315 }
314319 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))))) {
315320 return 'UnravelTape';
316321 }
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, {});
320325 if (id !== undefined) return id;
321326 return 'DuctTape';
322327 }
323328
324329 function eval_UnravelTape(pf, x, y) {
325330 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, {});
329334 if (id !== undefined) return id;
330335 return 'UnravelTape';
331336 }
332337
333338 function eval_Twig(pf, x, y) {
334339 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, {});
340345 if (id !== undefined) return id;
341346 return 'Twig';
342347 }
346351 if (true) {
347352 return 'BigZappy';
348353 }
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, {});
352357 if (id !== undefined) return id;
353358 return 'Zappy';
354359 }
358363 if (true) {
359364 return 'Air';
360365 }
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, {});
364369 if (id !== undefined) return id;
365370 return 'BigZappy';
366371 }
367372
368373 function eval_Randomizer(pf, x, y) {
369374 var id;
370 id = evalClass_Support(pf, x, y);
375 id = evalClass_Support(pf, x, y, {});
371376 if (id !== undefined) return id;
372377 return 'Randomizer';
373378 }