packages feed

swarm-0.7.0.0: data/scenarios/Tutorials/place.yaml

version: 1
name: Place
description: |
  Learn how to interact with the world by harvesting entities and placing them.
#
# Placing the tree is motivated by speeding up tree collection as their growth
# is really slow. It can be cheesed by speeding up the game, but there is no need
# to tell the players. :)
#
objectives:
  - goal:
      - Previously you learned how to plunder a plentiful forest for wood. Now you will learn how to plant trees to obtain as much wood as you need.
      - There is a fast-growing tree (called `spruce`{=entity}) ahead of you.  You could `grab` it as before, but you now have a new device called a `harvester`{=entity}. If you `harvest` a tree rather than `grab` it, a new tree will grow in its place after some time.
      - You can also place items from your inventory on the ground below you using the `place` command.
      - |
        Using these commands in conjunction, you can plant new growable entities by
        placing and then harvesting them.  For example, to plant a new `spruce`{=entity} seed
        you can write:
        ```
        place "spruce"; harvest
        ```
      - Your goal is to collect 6 `spruce`{=entity} trees.  You can speed this up by planting more trees.
      - |
        **TIP:** You can get a sneak peak at a feature we will explain later and type:
        ```
        def t = move; place "spruce"; harvest; end
        ```
        after which you only need to type `t`{=snippet} instead of retyping the whole
        command or searching in your command history.
    condition: |
      try {
        t <- as base {count "spruce"};
        pure (t >= 6);
      } { pure false }
entities:
  # faster tree (the normal one grows 500-600 ticks)
  - name: spruce
    display:
      attr: plant
      char: 'T'
    description:
      - |
        A tall, living entity made of a tough cellular material called "wood".
        They regrow after being harvested and are an important raw ingredient used
        in making many different devices.
      - |
        This one seems to grow a little faster.
    properties: [pickable, growable]
    growth: [100, 120]
solution: |
  def t = move; place "spruce"; harvest; end;
  def h = harvest; move end;
  // wait without needing a clock: literally spin our wheels
  def w4 = turn left; turn left; turn left; turn left end;
  def w16 = w4; w4; w4; w4 end;
  def w64 = w16; w16; w16; w16 end;
  def w256 = w64; w64; w64; w64 end;
  move;
  move; harvest; t; t; t; t; t;
  w256;
  turn back; h; h; h; h; h; h;
robots:
  - name: base
    dir: east
    devices:
      - treads
      - grabber
      - harvester
      - logger
      - compass
      - dictionary
    inventory:
      - [0, spruce]
world:
  palette:
    '>': [grass, null, base]
    '.': [grass]
    'T': [grass, spruce]
    '+': [stone, wall]
  upperleft: [-1, 1]
  map: |
    ++++++++++
    +>.T.....+
    ++++++++++