packages feed

swarm-0.7.0.0: data/scenarios/Challenges/hackman.yaml

version: 1
name: Hackman
author: Karl Ostmo
description: |
  Feed Hackman caffeine pellets
creative: false
attrs:
  - name: ghost1
    fg: "#ff0000"
  - name: ghost2
    fg: "#ffb8ff"
  - name: ghost3
    fg: "#00ffff"
  - name: ghost4
    fg: "#ffb852"
  - name: strawberry
    fg: "#ff0000"
objectives:
  - teaser: Get pellets
    goal:
      - |
        Pick up all of the caffeine `pellet`{=entity}s so that Hackman can write more code.
      - |
        Pay no mind to the colorful ghosts meandering about. That is, unless
        you are feeling generous with your `donut`{=entity}s...
      - |
        Can you find all of the secret objectives?
    condition: |
      as base {
        pcount <- count "pellet";
        donut_count <- count "donut";
        pure $ pcount >= 181;
      };
  - id: donut_given
    teaser: Give to ghost
    hidden: true
    optional: true
    goal:
      - |
        Give a ghost a donut.
    condition: |
      def anyHasPowerup = \n.
          let ghost_name = "ghost" ++ format n in
          ghost <- robotnamed ghost_name;
          hasPowerup <- as ghost {
              has "donut";
          };

          if hasPowerup {
              pure true;
          } {
              if (n > 1) {
                  anyHasPowerup $ n - 1;
              } {
                  pure false;
              }
          }
          end;

      anyHasPowerup 4;
  - teaser: Interloper
    hidden: true
    optional: true
    goal:
      - |
        Invade the ghost den
    condition: |
      loc <- as base {
        whereami;
      };
      pure $ loc == (0, 0);
  - teaser: World wrap
    hidden: true
    optional: true
    goal:
      - |
        Be teleported
    condition: |
      r <- robotnamed "teleport_monitor";
      loc <- as r {
        has "bit (0)"
      };
  - teaser: Balanced diet
    hidden: true
    optional: true
    goal:
      - |
        Get the strawberry
    condition: |
      as base {
        has "strawberry";
      };
  - teaser: Magnanimity
    hidden: true
    optional: true
    prerequisite: donut_given
    goal:
      - |
        Give all ghosts a donut.
    condition: |
      def allHasPowerup = \n.
          let ghost_name = "ghost" ++ format n in
          ghost <- robotnamed ghost_name;
          hasPowerup <- as ghost {
              has "donut";
          };

          if hasPowerup {
              if (n > 1) {
                  allHasPowerup $ n - 1;
              } {
                  pure true;
              }
          } {
              pure false;
          }
          end;

      allHasPowerup 4;
robots:
  - name: base
    display:
      orientationMap:
        east: 'c'
        north: 'u'
        west: 'ↄ'
        south: 'n'
      char: 'U'
      attr: gold
    dir: east
    devices:
      - ADT calculator
      - antenna
      - bitcoin
      - branch predictor
      - clock
      - compass
      - comparator
      - counter
      - dictionary
      - drill
      - grabber
      - lambda
      - lodestone
      - logger
      - mirror
      - net
      - scanner
      - strange loop
      - treads
      - workbench
  - name: teleport_monitor
    dir: north
    system: true
    display:
      invisible: true
      char: 'T'
    program: |
      run "scenarios/Challenges/_hackman/teleport_monitor.sw"
  - name: ghost1
    dir: north
    system: true
    display:
      invisible: false
      char: '∩'
      attr: ghost1
    program: |
      run "scenarios/Challenges/_hackman/ghost.sw"
  - name: ghost2
    dir: north
    system: true
    display:
      invisible: false
      char: '∩'
      attr: ghost2
    program: |
      run "scenarios/Challenges/_hackman/ghost.sw"
  - name: ghost3
    dir: north
    system: true
    display:
      invisible: false
      char: '∩'
      attr: ghost3
    program: |
      run "scenarios/Challenges/_hackman/ghost.sw"
  - name: ghost4
    dir: north
    system: true
    display:
      invisible: false
      char: '∩'
      attr: ghost4
    program: |
      run "scenarios/Challenges/_hackman/ghost.sw"
  - name: fruit_maker
    dir: north
    system: true
    display:
      invisible: true
      char: 'f'
    inventory:
      - [1, strawberry]
    program: |
      run "scenarios/Challenges/_hackman/fruit_maker.sw"
entities:
  - name: pellet
    display:
      char: '•'
      attr: silver
    description:
      - A caffeine pellet.
      - Helps Hackman produce more code.
    properties: [known, pickable]
  - name: donut
    display:
      char: 'o'
      attr: gold
    description:
      - Breakfast of champions.
      - Fancied by ghosts. Will you share?
    properties: [known, pickable]
  - name: den key
    display:
      char: 'k'
      attr: gold
    description:
      - Opens a gate
    properties: [known, pickable]
  - name: strawberry
    display:
      char: 'v'
      attr: strawberry
    description:
      - A tart berry
      - Possessing this fruit gives you great satisfaction.
    properties: [known, pickable]
  - name: gate
    display:
      char: '='
    description:
      - A gate.
    properties: [known, unwalkable]
  - name: wall
    display:
      char: '▒'
    description:
      - A wall.
    properties: [known, unwalkable]
recipes:
  - in:
      - [181, "pellet"]
    out:
      - [1, "den key"]
  - in:
      - [1, "den key"]
      - [1, "gate"]
    out:
      - [1, "den key"]
    required:
      - [1, drill]
solution: |
  run "scenarios/Challenges/_hackman/solution.sw"
known: []
seed: 0
world:
  palette:
    'B': [blank]
    'Ω': [blank, null, base]
    'f': [blank, null, fruit_maker]
    'a': [blank, null, ghost1]
    'b': [blank, null, ghost2]
    'c': [blank, null, ghost3]
    'd': [blank, null, ghost4]
    '.': [blank, pellet]
    '*': [blank, donut]
    'x': [blank, wall]
    'T': [blank, null, teleport_monitor]
    '=': [blank, gate]
    '+': [stone, wall]
    'W':
      cell: [blank]
      waypoint:
        name: western_exit
    'X':
      cell: [blank]
      waypoint:
        name: western_entrance
    'Y':
      cell: [blank]
      waypoint:
        name: eastern_exit
    'Z':
      cell: [blank]
      waypoint:
        name: eastern_entrance
  portals:
    - entrance: eastern_entrance
      exitInfo:
        exit: western_exit
    - entrance: western_entrance
      exitInfo:
        exit: eastern_exit
  upperleft: [-12, 10]
  map: |-
    BxxxxxxxxxxxxxxxxxxxxxxxT
    Bx..........x..........xB
    Bx*xxx.xxxx.x.xxxx.xxx*xB
    Bx.xxx.xxxx.x.xxxx.xxx.xB
    Bx.....................xB
    Bx.xxx.x.xxxxxxx.x.xxx.xB
    Bx.....x....x....x.....xB
    Bxxxxx.xxxxBxBxxxx.xxxxxB
    BBBBBx.xBBBBBBBBBx.xBBBBB
    Bxxxxx.xB+++=+++Bx.xxxxxB
    ZYBBBB.BB+abBcd+BB.BBBBWX
    Bxxxxx.xB+++++++Bx.xxxxxB
    BBBBBx.xBBBfΩBBBBx.xBBBBB
    Bxxxxx.xBxxxxxxxBx.xxxxxB
    Bx..........x..........xB
    Bx.xxx.xxxx.x.xxxx.xxx.xB
    Bx*..x.............x..*xB
    Bxxx.x.x.xxxxxxx.x.x.xxxB
    Bx.....x....x....x.....xB
    Bx.xxxxxxxx.x.xxxxxxxx.xB
    Bx.....................xB
    BxxxxxxxxxxxxxxxxxxxxxxxB