Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Watch for lodestone #2146

Merged
merged 2 commits into from
Sep 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading