Skip to content

Commit

Permalink
geological battery scenario
Browse files Browse the repository at this point in the history
  • Loading branch information
kostmo committed Jan 27, 2024
1 parent aacdbf3 commit f460eab
Show file tree
Hide file tree
Showing 3 changed files with 120 additions and 0 deletions.
1 change: 1 addition & 0 deletions data/scenarios/Challenges/00-ORDER.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ word-search.yaml
gopher.yaml
ice-cream.yaml
combo-lock.yaml
burrow.yaml
hanoi.yaml
hackman.yaml
lights-out.yaml
Expand Down
44 changes: 44 additions & 0 deletions data/scenarios/Challenges/_burrow/solution.sw
Original file line number Diff line number Diff line change
@@ -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;
75 changes: 75 additions & 0 deletions data/scenarios/Challenges/burrow.yaml
Original file line number Diff line number Diff line change
@@ -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..
...

0 comments on commit f460eab

Please sign in to comment.