Skip to content

Commit

Permalink
Add solution for world101 tutorial (#1498)
Browse files Browse the repository at this point in the history
Closes #1450.

## Demo

    scripts/play.sh -i data/scenarios/Tutorials/world101.yaml --autoplay
  • Loading branch information
byorgey authored Sep 9, 2023
1 parent 008f062 commit 8ffd056
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 0 deletions.
36 changes: 36 additions & 0 deletions data/scenarios/Tutorials/world101.sw
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
def tB = turn back end
def tR = turn right end
def tL = turn left end

def m = move end
def m2 = m;m end
def m4 = m2;m2 end
def m8 = m4;m4 end
def m9 = m8;m end
def m10 = m8;m2 end

def mg = m; grab end

def get_3_trees : cmd unit =
tB; m; mg; mg; mg; tB; m4
end

def make_harvester : cmd unit =
make "log"; make "log"; make "log";
make "board"; make "board"; make "board";
make "box";
make "wooden gear"; make "wooden gear";
make "harvester"
end

def get_lambda : cmd unit =
m10; tR; m9; harvest; tB; m9; tL; m10
end

def solution : cmd unit =
build {get_3_trees}; wait 16; salvage;
make_harvester;
build {get_lambda}; wait 50; salvage
end;

solution
2 changes: 2 additions & 0 deletions data/scenarios/Tutorials/world101.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ objectives:
condition: |
try { as base {has "lambda"} } {return false}
prerequisite: get_harvester
solution: |
run "scenarios/Tutorials/world101.sw"
robots:
- name: base
display:
Expand Down
1 change: 1 addition & 0 deletions test/integration/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@ testScenarioSolutions rs ui =
, testTutorialSolution Default "Tutorials/require"
, testTutorialSolution (Sec 3) "Tutorials/requireinv"
, testTutorialSolution Default "Tutorials/conditionals"
, testTutorialSolution Default "Tutorials/world101"
, testTutorialSolution (Sec 5) "Tutorials/farming"
]
, testGroup
Expand Down

0 comments on commit 8ffd056

Please sign in to comment.