swarm-0.4: data/scenarios/Testing/1171-sniff-command.yaml
version: 1
name: Sniff test
creative: true
description: Locate a tree using sniff
objectives:
- goal:
- grab a tree.
condition: |
as base {has "tree"}
solution: |
def homeIn = \item. \oldDistance.
if (oldDistance > 0) {
move;
newDistance <- sniff item;
d <- if (newDistance > oldDistance) {
turn back;
move;
turn left;
return oldDistance;
} {
return newDistance;
};
homeIn item d;
} {
grab;
}
end;
let item = "tree" in
initialDistance <- sniff item;
homeIn item initialDistance;
robots:
- name: base
dir: [0,-1]
display:
char: Ω
attr: robot
devices:
- logger
- string
- grabber
- treads
known: []
world:
palette:
'Ω': [grass, null, base]
'.': [grass]
'T': [grass, tree]
upperleft: [0, 0]
map: |
.........
......T..
.........
.........
.Ω.......
.........