Skip to content

Commit b6e676f

Browse files
committed
geological battery scenario
1 parent aacdbf3 commit b6e676f

File tree

3 files changed

+120
-0
lines changed

3 files changed

+120
-0
lines changed

data/scenarios/Challenges/00-ORDER.txt

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ word-search.yaml
88
gopher.yaml
99
ice-cream.yaml
1010
combo-lock.yaml
11+
burrow.yaml
1112
hanoi.yaml
1213
hackman.yaml
1314
lights-out.yaml
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
2+
def doN = \n. \f. if (n > 0) {f; doN (n - 1) f} {}; end;
3+
4+
def moveUntilBlocked =
5+
b <- blocked;
6+
if b {} {move; moveUntilBlocked}
7+
end;
8+
9+
def drillUntilStuck : cmd (unit + text) =
10+
try {
11+
maybeRetrieved <- drill forward;
12+
case maybeRetrieved (\_. return $ inL ()) (\_.
13+
move;
14+
drillUntilStuck;
15+
);
16+
return maybeRetrieved;
17+
} {
18+
return $ inL ();
19+
}
20+
end;
21+
22+
def go =
23+
turn west;
24+
doN 47 move;
25+
turn right;
26+
27+
doN 6 (
28+
moveUntilBlocked;
29+
maybeItem <- drillUntilStuck;
30+
31+
case maybeItem return (\x.
32+
iCount <- count x;
33+
if (iCount < 3) {
34+
turn left; drill forward; turn left
35+
} {
36+
turn back;
37+
}
38+
);
39+
40+
41+
);
42+
end;
43+
44+
go;

data/scenarios/Challenges/burrow.yaml

+75
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
version: 1
2+
name: Burrow
3+
author: Karl Ostmo
4+
description: |
5+
Encourage a creature into its burrow
6+
creative: false
7+
seed: 4
8+
attrs:
9+
- name: clay
10+
fg: "#ffff99"
11+
bg: "#b15928"
12+
objectives:
13+
- teaser: Something
14+
goal:
15+
- |
16+
Something
17+
condition: |
18+
return false
19+
robots:
20+
- name: base
21+
dir: [1, 0]
22+
devices:
23+
- 3D printer
24+
- blueprint
25+
- branch predictor
26+
- ADT calculator
27+
- clock
28+
- comparator
29+
- compass
30+
- counter
31+
- dictionary
32+
- drill
33+
- fast grabber
34+
- GPS receiver
35+
- harvester
36+
- hearing aid
37+
- keyboard
38+
- lambda
39+
- logger
40+
- net
41+
- rolex
42+
- scanner
43+
- strange loop
44+
- toolkit
45+
- treads
46+
- welder
47+
- workbench
48+
solution: |
49+
run "scenarios/Challenges/_burrow/solution.sw"
50+
entities:
51+
- name: clay
52+
display:
53+
attr: clay
54+
char: '*'
55+
description:
56+
- clay
57+
properties: [known, unwalkable, pickable]
58+
known: [tree, rock, flower, boulder]
59+
world:
60+
dsl: |
61+
let
62+
lakeNoise = perlin (seed + 1) 1 0.25 0.0
63+
in
64+
overlay
65+
[ {grass}
66+
, mask (lakeNoise > 0.4 && lakeNoise <= 0.9) {clay}
67+
]
68+
upperleft: [0, 0]
69+
offset: false
70+
palette:
71+
'B': [grass, erase, base]
72+
'.': [grass, erase]
73+
map: |
74+
B..
75+
...

0 commit comments

Comments
 (0)