swarm-0.7.0.0: data/scenarios/Testing/699-movement-fail/699-move-liquid.yaml
version: 1
name: Move to liquid
description: |
Robot moving to water location results in its drowning.
https://github.com/swarm-game/swarm/issues/699
objectives:
- condition: |
def isAliveOn = \name.\loc. try {r <- robotNamed name; l <- as r {whereami}; pure $ l == loc} {pure false} end;
def isDead = \name. try {robotNamed name; pure false} {pure true} end;
d1 <- isDead "one";
a2 <- isAliveOn "two" (1,-2);
a3 <- isAliveOn "three" (1,-3);
b <- isAliveOn "base" (0,0);
pure (d1 && a2 && a3 && b)
solution: |
move; say "Fatal error: base was able to move into water and not fail!"
robots:
- name: base
dir: east
devices: ["treads", "logger"]
- name: one
dir: east
devices: ["treads", "logger"]
program: |
move; say "Fatal error: one was able to move into water and not fail or drown!"
- name: two
dir: east
devices: ["treads", "logger", "boat", "net"]
program: |
try {move} {say "Fatal error: two was unable to move into water even though it has a boat!"}
- name: three
dir: east
system: true
devices: ["logger"]
program: |
try {move} {say "Fatal error: three was unable to move into water even though it is system robot!"}
world:
palette:
'~': [stone, water]
'B': [grass, null, base]
'1': [grass, null, one]
'2': [grass, null, two]
'3': [grass, null, three]
'+': [stone, wall]
upperleft: [-1, 1]
map: |
++++
+B~+
+1~+
+2~+
+3~+
++++