Skip to content

Commit

Permalink
Use command to check goal in sheep scenario
Browse files Browse the repository at this point in the history
  • Loading branch information
kostmo committed Sep 17, 2023
1 parent c46edcf commit be55b76
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,9 @@
// The breadcrumb is oriented in case a single-width passage is backtracked
// along the opposite wall.)

/** A "gate" is walkable, so we need to supplement the "blocked" check with this function.
Since fences are "unwalkable", they do not need to be mentioned in this function.
*/
def isFenced =
s <- scan forward;
return (
case s
(\_. false)
(\x. x == "gate")
);
end;

def isBlockedOrFenced =
b <- blocked;
f <- isFenced;
return (b || f);
return b;
end;

// Returns true if we've already placed two
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ SCENARIO_FILE=$PARENT_DIR/gated-paddock.yaml

PROGRAM=$(cat $SCRIPT_DIR/enclosure-checking.sw | sed -e 's/[[:blank:]]\+$//') yq -i '.objectives[0].condition = strenv(PROGRAM) | .objectives[].condition style="literal"' $SCENARIO_FILE

stack run -- --scenario $SCENARIO_FILE --run $SCRIPT_DIR/fence-construction.sw --cheat
stack run --fast -- --scenario $SCENARIO_FILE --run $SCRIPT_DIR/fence-construction.sw --cheat
17 changes: 2 additions & 15 deletions data/scenarios/Challenges/Ranching/gated-paddock.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,22 +35,9 @@ objectives:
// The breadcrumb is oriented in case a single-width passage is backtracked
// along the opposite wall.)
/** A "gate" is walkable, so we need to supplement the "blocked" check with this function.
Since fences are "unwalkable", they do not need to be mentioned in this function.
*/
def isFenced =
s <- scan forward;
return (
case s
(\_. false)
(\x. x == "gate")
);
end;
def isBlockedOrFenced =
b <- blocked;
f <- isFenced;
return (b || f);
return b;
end;
// Returns true if we've already placed two
Expand Down Expand Up @@ -142,7 +129,7 @@ objectives:
create specialDrill;
equip specialDrill;
// **NOTE:** System robots can walk on water
// NOTE: System robots can walk on water
// so we only need this if we want to
// demo the algorithm with a player robot.
// create "boat";
Expand Down

0 comments on commit be55b76

Please sign in to comment.