packages feed

swarm-0.6.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";
        return $ fCount >= 4;
      };
solution: |
  def goDir = \f. \result.
    let d = fst result in
    if (d == down) {grab; f;} {turn d; move; f;}
    end;

  def followRoute =
      nextDir <- path (inL ()) (inR "flower");
      case nextDir return $ 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