swarm-0.7.0.0: data/scenarios/Testing/1575-structure-recognizer/1575-ensure-single-recognition.yaml
version: 1
name: Structure recognizer - single recognition
description: |
Ensure that only a single structure is recognized
when placing an entity would complete more than one
structure template.
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 `gold`{=entity}
condition: |
def length : (rec l. Unit + a * l) -> Int = \l.
case l (\_. 0) (\cons. match cons \_. \rest. 1 + length rest)
end;
robotHasGold <- as base {has "gold"};
foundStructures <- structures "chessboard";
pure $ length foundStructures >= 2 && robotHasGold;
robots:
- name: base
dir: south
devices:
- grabber
- treads
inventory:
- [1, gold]
- [1, silver]
solution: |
move;
place "silver";
move; move; move;
turn left;
move; move; move; move;
place "gold";
structures:
- name: chessboard
recognize: [north]
structure:
mask: '.'
palette:
'g': [stone, gold]
's': [stone, silver]
map: |
gsgs
sgsg
gsgs
sgsg
world:
name: root
dsl: |
{blank}
palette:
'.': [grass]
'g': [grass, gold]
's': [grass, silver]
'B': [grass, null, base]
upperleft: [0, 0]
map: |
...B....
gsg.gsgs
sgsgsgsg
gsgsgsgs
sgsgsgs.