swarm-0.2.0.0: 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}`,
where in place of `COMMANDS` you write the sequence
of commands for the robot to execute (separated by semicolons).
- Build a robot to harvest the flower and place it next
to the water.
- |
TIP: You can use the name of the flower directly ("pickerelweed"),
or you can use bind notation: `f <- harvest; ... ; place f;`.
- |
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 "pickerelweed";
move;
b <- ishere "pickerelweed";
move;
c <- ishere "pickerelweed";
return (a || b || c);
} { return false }
entities:
- name: pickerelweed
display:
attr: flower
char: '*'
description:
- A small plant that grows near the water.
properties: [known, portable, growable]
# It would make sense for the plant to NOT grow away from water.
# But if the player sent a robot that grabbed it and then did not
# place it, another robot would need to salvage that robot.
solution: |
build {turn right; move; move; t <- harvest; turn right; move; place t}
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:
default: [blank]
palette:
'Ω': [grass, null, base]
'.': [grass]
'~': [ice, water]
'*': [grass, pickerelweed]
'┌': [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: |
┌───┐
│Ω.*│
│...│
│~~~│
└───┘