swarm-0.7.0.0: data/scenarios/Testing/1569-pathfinding-cache/1569-harvest-batch.yaml
version: 1
name: Pathfinding cache - harvest entity batches
description: |
Demonstrates repeated application of `path` command to
harvest a cluster of entities. Upon each harvest,
the path cache shall be invalidated since the destination
entity has been removed.
creative: false
objectives:
- goal:
- Get 4 flowers.
condition: |
as base {
fCount <- count "flower";
pure $ fCount >= 4;
};
solution: |
def goDir = \f. \result.
match result \d. \_.
if (d == down) {grab; f;} {turn d; move; f;}
end;
def followRoute =
nextDir <- path (inL ()) (inR "flower");
case nextDir pure $ goDir followRoute;
end;
followRoute;
entities:
- name: wayfinder
display:
char: 'w'
description:
- Enables `path` command
properties: [known, pickable]
capabilities: [path]
robots:
- name: base
dir: east
devices:
- ADT calculator
- branch predictor
- comparator
- compass
- dictionary
- logger
- grabber
- treads
- wayfinder
known: [flower]
world:
palette:
'B': [grass, erase, base]
'.': [grass]
'f': [grass, flower]
upperleft: [0, 0]
map: |
B...
..ff
..ff