swarm-0.7.0.0: data/scenarios/Testing/1575-structure-recognizer/1575-ensure-disjoint.yaml
version: 1
name: Structure recognizer - Disjoint recognitions
description: |
Ensure that the completion of a second structure
template is not recognized if it overlaps
with a previously completed structure.
Player starts with 3 `silver`{=entity}. A win
should not be counted until all three are placed.
creative: false
objectives:
- teaser: Build 2 `chessboard`{=structure}s
prerequisite:
not: premature_win
goal:
- |
Build 2 of the same structure
condition: |
def length : (rec l. Unit + a * l) -> Int = \l.
case l (\_. 0) (\cons. match cons \_. \rest. 1 + length rest)
end;
foundStructures <- structures "chessboard";
pure $ length foundStructures >= 2
- id: premature_win
teaser: Don't count win early
optional: true
goal:
- |
Two structures shouldn't be recognized
while the bases still possesses `silver`{=entity}
condition: |
def length : (rec l. Unit + a * l) -> Int = \l.
case l (\_. 0) (\cons. match cons \_. \rest. 1 + length rest)
end;
robotHasSilver <- as base {has "silver"};
foundStructures <- structures "chessboard";
pure $ length foundStructures >= 2 && robotHasSilver;
robots:
- name: base
dir: south
devices:
- grabber
- treads
inventory:
- [3, silver]
solution: |
move;
turn left;
place "silver";
move; move;
place "silver";
move; move;
place "silver";
structures:
- name: chessboard
recognize: [north]
structure:
mask: '.'
palette:
'g': [stone, gold]
's': [stone, silver]
map: |
gsgs
sgsg
gsgs
sgsg
known: [water, gold, silver]
world:
name: root
dsl: |
{water}
palette:
'.': [grass, water]
'x': [grass, erase]
'g': [grass, gold]
's': [grass, silver]
'B': [grass, water, base]
upperleft: [0, 0]
map: |
...B....
gsgxgxgx
sgsgsgsg
gsgsgsgs
sgsgsgsg