-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
120 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.. | ||
... |