-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into feature/static-use
- Loading branch information
Showing
11 changed files
with
686 additions
and
362 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
93 changes: 93 additions & 0 deletions
93
data/scenarios/Testing/1575-structure-recognizer/2201-piecewise-lines.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
version: 1 | ||
name: Structure recognition - piecewise row recognition | ||
description: | | ||
Demonstrate general solution for transparency. | ||
In this scenario, a structure called `spaceship`{=structure} is occluded | ||
by a single cell overlay shape called `damage`{=structure}. | ||
The base swaps the "damage" entity with the correct part. | ||
creative: false | ||
objectives: | ||
- teaser: Recognize structure | ||
goal: | ||
- | | ||
`spaceship`{=structure} structure should be recognized upon completion. | ||
condition: | | ||
def isRight = \x. case x (\_. false) (\_. true); end; | ||
foundStructure <- structure "spaceship" 0; | ||
return $ isRight foundStructure; | ||
robots: | ||
- name: base | ||
dir: east | ||
devices: | ||
- ADT calculator | ||
- blueprint | ||
- fast grabber | ||
- logger | ||
- treads | ||
inventory: | ||
- [1, rock] | ||
solution: | | ||
move; move; move; move; move; move; move; | ||
swap "rock"; | ||
structures: | ||
- name: fragment | ||
recognize: [north] | ||
structure: | ||
palette: | ||
'z': [stone, pixel (R)] | ||
'w': [stone, pixel (B)] | ||
'x': [stone, rock] | ||
'y': [stone, mountain] | ||
mask: '.' | ||
map: | | ||
zw.xy | ||
- name: spaceship | ||
recognize: [north] | ||
structure: | ||
palette: | ||
'p': [stone, board] | ||
'x': [stone, rock] | ||
'y': [stone, mountain] | ||
'z': [stone, pixel (R)] | ||
'w': [stone, pixel (B)] | ||
'q': [stone, pixel (G)] | ||
mask: '.' | ||
map: | | ||
q....xy.zw.xy | ||
qq....ppp.... | ||
q....xy.xy.qq | ||
- name: damage | ||
description: A single-cell overwrite of the spaceship | ||
structure: | ||
palette: | ||
't': [stone, tree] | ||
map: | | ||
t | ||
- name: modified ship | ||
description: A spaceship with a single cell replaced by a `tree`{=entity} | ||
structure: | ||
placements: | ||
- src: spaceship | ||
- src: damage | ||
offset: [5, 0] | ||
map: "" | ||
known: [board, mountain, rock, tree, pixel (R), pixel (B)] | ||
world: | ||
dsl: | | ||
{blank} | ||
palette: | ||
'.': [grass, erase] | ||
'B': [grass, erase, base] | ||
'p': | ||
structure: | ||
name: modified ship | ||
cell: [grass] | ||
upperleft: [100, -100] | ||
map: | | ||
.......... | ||
B.p....... | ||
.......... | ||
.......... | ||
.......... |
94 changes: 94 additions & 0 deletions
94
data/scenarios/Testing/1575-structure-recognizer/2201-preclude-overlapping-recognition.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
version: 1 | ||
name: Structure recognition - precluding overlaps | ||
description: | | ||
A cell may be a member of at most one structure. | ||
creative: false | ||
objectives: | ||
- teaser: Recognize one structure | ||
goal: | ||
- | | ||
`line`{=structure} structure should be recognized upon completion. | ||
condition: | | ||
def isRight = \x. case x (\_. false) (\_. true); end; | ||
foundStructure <- structure "line" 0; | ||
return $ isRight foundStructure; | ||
- teaser: Recognize second structure | ||
id: found_elbow | ||
optional: true | ||
goal: | ||
- | | ||
`line`{=structure} structure should be recognized upon completion. | ||
condition: | | ||
def isRight = \x. case x (\_. false) (\_. true); end; | ||
foundStructure <- structure "elbow" 0; | ||
return $ isRight foundStructure; | ||
- teaser: Grab tree | ||
prerequisite: | ||
not: found_elbow | ||
goal: | ||
- | | ||
`grab` the `tree`{=entity} to indicate we are done with the test. | ||
condition: | | ||
as base {has "tree"}; | ||
robots: | ||
- name: base | ||
dir: north | ||
devices: | ||
- ADT calculator | ||
- blueprint | ||
- fast grabber | ||
- logger | ||
- treads | ||
inventory: | ||
- [5, rock] | ||
solution: | | ||
place "rock"; move; | ||
place "rock"; move; | ||
place "rock"; | ||
turn right; | ||
move; | ||
turn right; | ||
// Try to complete a second structure | ||
place "rock"; move; | ||
place "rock"; | ||
// Grab the tree to indicate completion | ||
turn left; | ||
move; | ||
move; | ||
move; | ||
grab; | ||
structures: | ||
- name: elbow | ||
recognize: [north] | ||
structure: | ||
palette: | ||
'x': [stone, rock] | ||
mask: '.' | ||
map: | | ||
xx | ||
.x | ||
- name: line | ||
recognize: [north] | ||
structure: | ||
palette: | ||
'x': [stone, rock] | ||
mask: '.' | ||
map: | | ||
x | ||
x | ||
x | ||
known: [rock] | ||
world: | ||
dsl: | | ||
{blank} | ||
palette: | ||
'.': [grass, erase] | ||
'T': [grass, tree] | ||
'B': [grass, erase, base] | ||
upperleft: [0, 0] | ||
map: | | ||
....... | ||
.....T. | ||
.B..... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
102 changes: 38 additions & 64 deletions
102
src/swarm-topography/Swarm/Game/Scenario/Topography/Structure/Recognition/Log.hs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.