swarm-0.7.0.0: data/scenarios/Testing/710-multi-robot.yaml
version: 1
name: Multiple robots in palette
description: |
Using multiple robots in palette to open new rooms.
See the lowright/upright robots in the second room.
https://github.com/swarm-game/swarm/issues/710
objectives:
- goal:
- Move to the end of the room.
condition: |
r <- robotNamed "check1";
as r {has "Win"}
- goal:
- Move to the end of the second room.
condition: |
r <- robotNamed "check2";
as r {has "Win"}
- goal:
- Move to the end of the third room.
condition: |
r <- robotNamed "check3";
as r {has "Win"}
solution: |
move;move;move; move;move;move; move;move;move;
world:
palette:
'.': [blank]
# FIRST ROOM
'+': [blank, wall]
'c': [blank, wall, corner0]
# SECOND ROOM
'1': [blank, wall, gate1]
'-': [blank, "1", wally]
'u': [blank, "1", wally, corner1]
'2': [blank, "1", wally, gate2]
# THIRD ROOM
'~': [blank, "2", wally]
upperleft: [-1, 1]
map: |
+++++c--u~~~
+....1..2..~
+++++c--u~~~
robots:
- name: base
dir: east
loc: [0, 0]
devices:
- treads
- logger
- name: check1
dir: [0, 0]
loc: [3, 0]
system: true
display:
invisible: true
program: |
def until = \c. b <- c; if b {} {until c} end;
l <- whereami;
until (
try {
loc <- as base {whereami};
pure (loc == l)
} { pure false }
);
create "Win"
- name: check2
dir: [0, 0]
loc: [6, 0]
system: true
display:
invisible: true
program: |
def until = \c. b <- c; if b {} {until c} end;
l <- whereami;
until (
try {
loc <- as base {whereami};
pure (loc == l)
} { pure false }
);
create "Win"
- name: check3
dir: [0, 0]
loc: [9, 0]
system: true
display:
invisible: true
program: |
def until = \c. b <- c; if b {} {until c} end;
l <- whereami;
until (
try {
loc <- as base {whereami};
pure (loc == l)
} { pure false }
);
create "Win"
- name: wally
dir: [0, 0]
system: true
display:
invisible: true
inventory: [[1, wall]]
program: |
def until = \c. b <- c; if b {} {until c} end;
n <- (s <- scan down; case s (\_. fail "Fatal error: missing room number!") pure);
c1 <- robotNamed ("check" ++ n);
until (as c1 {has "Win"});
swap "wall"
- name: corner0
dir: [0, 0]
system: true
display:
invisible: true
inventory: [[1, wall]]
program: |
def until = \c. b <- c; if b {} {until c} end;
c1 <- robotNamed "check1";
until (as c1 {has "Win"});
swap "wall"
- name: corner1
dir: [0, 0]
system: true
display:
invisible: true
inventory: [[1, wall]]
program: |
def until = \c. b <- c; if b {} {until c} end;
c1 <- robotNamed "check2";
until (as c1 {has "Win"});
swap "wall"
- name: gate1
dir: [0, 0]
system: true
display:
invisible: true
program: |
def until = \c. b <- c; if b {} {until c} end;
c1 <- robotNamed "check1";
until (as c1 {has "Win"});
grab
- name: gate2
dir: [0, 0]
system: true
display:
invisible: true
program: |
def until = \c. b <- c; if b {} {until c} end;
c1 <- robotNamed "check2";
until (as c1 {has "Win"});
grab
entities:
- name: Win
display:
char: W
attr: gold
description:
- This entity signals that the objective has been met.
- name: "1"
display:
char: W
invisible: true
description:
- This entity is used to mean that the robot should check the 1st objective.
- name: "2"
display:
char: W
invisible: true
description:
- This entity is used to mean that the robot should check the 2nd objective.