swarm-0.4: data/scenarios/Tutorials/build.yaml
version: 1
name: Build
description: |
Learn how to build robots to carry out simple tasks.
#
# Has to be easy, so that you do not have to debug it too much yet.
#
objectives:
- goal:
- Now that you know basic commands, it is time to
build robots to do the work for you.
You will start in a base ('Ω') that does not move (at least not yet).
- Let's start by building a gardener robot to perform a simple task.
- You can `build` a robot with `build {COMMANDS}`{=snippet},
where in place of `COMMANDS`{=snippet} you write the sequence
of commands for the robot to execute (separated by semicolons).
- |
Build a robot to harvest the `flower`{=entity} and place it next
to the `water`{=entity}.
- |
**TIP:** Newly built robots start out facing the same
direction as their parent, which in the tutorials will always be north.
condition: |
try {
teleport self (0,-1);
turn east;
a <- ishere "flower";
move;
b <- ishere "flower";
move;
c <- ishere "flower";
return (a || b || c);
} { return false }
solution: |
build {turn right; move; move; harvest; turn right; move; place "flower"}
robots:
- name: base
dir: [0,1]
heavy: true
display:
char: Ω
attr: robot
devices:
- logger
- 3D printer
inventory:
- [10, logger]
- [10, compass]
- [10, solar panel]
- [10, harvester]
- [10, treads]
known: [water]
world:
palette:
'Ω': [grass, null, base]
'.': [grass]
'~': [ice, water]
'*': [grass, flower]
'┌': [stone, upper left corner]
'┐': [stone, upper right corner]
'└': [stone, lower left corner]
'┘': [stone, lower right corner]
'─': [stone, horizontal wall]
'│': [stone, vertical wall]
upperleft: [-1, 1]
map: |
┌───┐
│Ω.*│
│...│
│~~~│
└───┘