Skip to content

Commit

Permalink
close loophole
Browse files Browse the repository at this point in the history
  • Loading branch information
kostmo committed Nov 2, 2024
1 parent 3c77191 commit fdeb276
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 24 deletions.
16 changes: 5 additions & 11 deletions data/scenarios/Challenges/Ranching/_pied-piper/rat.sw
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
def moveWithMorbidity =
let mold = "mold" in
moldHere <- ishere mold;
moldHere <- ishere "mold";
if moldHere {
try {
// handle race conditions in which
// another robot grabs it first
m <- harvest;
if (m == mold) {
say $ "Yuck, " ++ mold ++ "! I'm outta here.";
let spores = "mold spores" in
if (m == spores) {
say $ "Yuck, " ++ spores ++ "! I'm outta here.";
selfdestruct;
} {};
} {};
} {};

move;
end;

Expand Down Expand Up @@ -112,9 +111,4 @@ def go = \startLoc.
end;

startLoc <- whereami;
let shouldDestruct = false in
if shouldDestruct {
selfdestruct;
} {
go startLoc;
}
go startLoc;
8 changes: 4 additions & 4 deletions data/scenarios/Challenges/Ranching/_pied-piper/solution.sw
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,10 @@ def getKey =
move;
end;

def placeMold =
def placeMold = \moldItem.
turn east;
doN 11 move;
sow "mold";
sow moldItem;
end;

def go =
Expand All @@ -134,7 +134,7 @@ def go =
doN 4 move;
turn left;
doN 3 move;
harvest;
moldItem <- grab;
turn back;
doN 3 move;

Expand Down Expand Up @@ -185,7 +185,7 @@ def go =
makeOatsTrail 4 12;
placeHorizontalTrail 4;

placeMold;
placeMold moldItem;
end;

go;
37 changes: 28 additions & 9 deletions data/scenarios/Challenges/Ranching/pied-piper.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ objectives:
- teaser: Silo
id: silo
goal:
- Inspect the `storage silo`{=structure}
- Inspect the `storage silo`{=structure}.
condition: |
as base {
loc <- locateme;
Expand All @@ -96,16 +96,16 @@ objectives:
id: moldy
goal:
- A `rat`{=robot} will `selfdestruct` if it comes in contact with `mold`{=entity}.
- Obtain some `mold`{=entity}.
- Obtain some `mold spores`{=entity}.
condition: |
as base {
has "mold";
has "mold spores";
}
- teaser: Corral
prerequisite: moldy
goal:
- Dispatch the `rat`{=robot}s with `mold`{=entity}.
- Note that `mold`{=entity} will only spread when `sow`n in a dark, damp environment.
- Note that `mold spores`{=entity} will only spread when `sow`n in a dark, damp environment.
condition: |
try {
r <- robotNamed "rat";
Expand Down Expand Up @@ -206,14 +206,33 @@ entities:
attr: mold
char: 'm'
description:
- Spreads in dark, damp environment
- Spreads in dark, damp environment.
- Toxic to `rat`{=robot}s.
- Yields `mold spores`{=entity} when `harvest`ed or `grab`bed.
properties: [known, pickable, growable]
yields: mold spores
growth:
duration: [15, 30]
spread:
radius: 2
density: 0.3
biomes: [clay]
- name: mold spores
display:
attr: mold
char: '*'
description:
- Grows into `mold`{=entity} in dark, damp environments.
- In spore form, has no effect on `rat`{=robot}s.
properties: [known, pickable, growable]
yields: mold spores
growth:
duration: [15, 30]
mature: mold
spread:
radius: 2
density: 0.3
biomes: [clay]
known: [water, boulder]
structures:
- name: storage silo
Expand Down Expand Up @@ -308,10 +327,10 @@ subworlds:
consistent: true
upperleft: [-1, 1]
map: |
++xHxxxxx
++x.x+.mx
++x.x+m.x
++x.x++.x
++xHx+xx+
++x.xx.mx
++x.xxm.x
++x.xxx.x
++x.....x
+++x.xxxx
+++x.x+++
Expand Down

0 comments on commit fdeb276

Please sign in to comment.