diff --git a/data/scenarios/Challenges/00-ORDER.txt b/data/scenarios/Challenges/00-ORDER.txt index 674e0cba3..83099ee2a 100644 --- a/data/scenarios/Challenges/00-ORDER.txt +++ b/data/scenarios/Challenges/00-ORDER.txt @@ -8,6 +8,7 @@ word-search.yaml gopher.yaml ice-cream.yaml combo-lock.yaml +burrow.yaml hanoi.yaml hackman.yaml lights-out.yaml diff --git a/data/scenarios/Challenges/_burrow/solution.sw b/data/scenarios/Challenges/_burrow/solution.sw new file mode 100644 index 000000000..c46363319 --- /dev/null +++ b/data/scenarios/Challenges/_burrow/solution.sw @@ -0,0 +1,44 @@ + +def doN = \n. \f. if (n > 0) {f; doN (n - 1) f} {}; end; + +def moveUntilBlocked = + b <- blocked; + if b {} {move; moveUntilBlocked} + end; + +def drillUntilStuck : cmd (unit + text) = + try { + maybeRetrieved <- drill forward; + case maybeRetrieved (\_. return $ inL ()) (\_. + move; + drillUntilStuck; + ); + return maybeRetrieved; + } { + return $ inL (); + } + end; + +def go = + turn west; + doN 47 move; + turn right; + + doN 6 ( + moveUntilBlocked; + maybeItem <- drillUntilStuck; + + case maybeItem return (\x. + iCount <- count x; + if (iCount < 3) { + turn left; drill forward; turn left + } { + turn back; + } + ); + + + ); + end; + +go; \ No newline at end of file diff --git a/data/scenarios/Challenges/burrow.yaml b/data/scenarios/Challenges/burrow.yaml new file mode 100644 index 000000000..15a26406c --- /dev/null +++ b/data/scenarios/Challenges/burrow.yaml @@ -0,0 +1,75 @@ +version: 1 +name: Burrow +author: Karl Ostmo +description: | + Encourage a creature into its burrow +creative: false +seed: 4 +attrs: + - name: clay + fg: "#ffff99" + bg: "#b15928" +objectives: + - teaser: Something + goal: + - | + Something + condition: | + return false +robots: + - name: base + dir: [1, 0] + devices: + - 3D printer + - blueprint + - branch predictor + - ADT calculator + - clock + - comparator + - compass + - counter + - dictionary + - drill + - fast grabber + - GPS receiver + - harvester + - hearing aid + - keyboard + - lambda + - logger + - net + - rolex + - scanner + - strange loop + - toolkit + - treads + - welder + - workbench +solution: | + run "scenarios/Challenges/_burrow/solution.sw" +entities: + - name: clay + display: + attr: clay + char: '*' + description: + - clay + properties: [known, unwalkable, pickable] +known: [tree, rock, flower, boulder] +world: + dsl: | + let + lakeNoise = perlin (seed + 1) 1 0.25 0.0 + in + overlay + [ {grass} + , mask (lakeNoise > 0.4 && lakeNoise <= 0.9) {clay} + ] + upperleft: [0, 0] + offset: false + palette: + 'B': [grass, erase, base] + '.': [grass, erase] + map: | + B.. + ...