Skip to content

Commit

Permalink
Watch for lodestone
Browse files Browse the repository at this point in the history
  • Loading branch information
xsebek committed Sep 15, 2024
1 parent 7b99e72 commit ba8dae3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
14 changes: 8 additions & 6 deletions data/scenarios/Testing/562-lodestone.sw
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@ def ifC = \p.\t.\e.
if b t e
end;

def until = \p.\t.
ifC p t {until p t}
def waitFor = \e.\t.
watch down;
wait 100;
ifC (ishere e) t {waitFor e t}
end;

def repeat = \c.
Expand All @@ -29,18 +31,18 @@ end;

// get one lodestone
build {log "Hey!"; turn north; m2; l <- grab; turn back; m2; place l};
until (ishere "lodestone") {grab};
waitFor "lodestone" {grab};

// get two bit (0)
build {
log "Hi!";
repeat (
log "I am going for a bit";
turn east; m2; x <- until (ishere "bit (0)") {harvest}; turn back; m2; place x;
turn east; m2; x <- waitFor "bit (0)" {harvest}; turn back; m2; place x;
log "I brought a bit";
)};
until (ishere "bit (0)") {grab};
until (ishere "bit (0)") {grab};
waitFor "bit (0)" {grab};
waitFor "bit (0)" {grab};

make "bit (1)";
make "drill bit"
2 changes: 2 additions & 0 deletions data/scenarios/Testing/562-lodestone.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ robots:
- workbench
- 3D printer
- branch predictor
- rolex
inventory:
- [10, drill]
- [10, lambda]
Expand All @@ -37,6 +38,7 @@ robots:
- [10, strange loop]
- [10, branch predictor]
- [10, toolkit]
- [10, rolex]
- [0, drill bit]
- [0, bit (0)]
- [0, bit (1)]
Expand Down

0 comments on commit ba8dae3

Please sign in to comment.