-
Notifications
You must be signed in to change notification settings - Fork 52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ensure no overlaps in initial placement of recognized structures #2212
Conversation
b96c3fa
to
c11fe89
Compare
c11fe89
to
c890f00
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why does the overlap need to be detected? Does the structure recognition algorithm only find one?
-- So we just use the same sorting criteria as the one used to resolve recognition | ||
-- conflicts at entity placement time. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't follow. What are those criteria? A link to another comment or function would be helpful.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added more comments and cross-references.
src/swarm-topography/Swarm/Game/Scenario/Topography/Structure/Recognition/Type.hs
Show resolved
Hide resolved
data/scenarios/Testing/1575-structure-recognizer/2201-initial-recognition-overlap.yaml
Show resolved
Hide resolved
0e1a798
to
c2061c3
Compare
While the game is being played, the structure recognition algorithm ensures that only one of potentially multiple overlapping structures will be recognized. However, at game state initialization time, we're not actually running the structure recognition automata. Instead we simply check all the locations of pre-placed structures and ensure they are still intact, given potential overlapping placements. Importantly, two structures could overlap but still be independently "intact"; this PR adds logic to ensure mutual-exclusivity. |
import Swarm.Language.Syntax.Direction (AbsoluteDir) | ||
|
||
newtype StructureName = StructureName Text |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
newtype StructureName = StructureName Text | |
newtype StructureName = StructureName { getStructureName :: Text } |
Then we don't need the separate declaration of getStructureName
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This results in some kind of JSON parse error I've yet to look into.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, weird. Well, don't worry about it then, it's not a big deal.
097d111
to
587ad2b
Compare
Would you like to approve this, @byorgey? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, sorry, thanks for the nudge!
Implements overlap resolution for pre-placed recognized structures.
Also introduces a
NonEmptyGrid
type, towards #2004.Testing
Other changes
OriginalName
->OrientedStructure
)LocatedStructure
)zipNumberedNE
functionmapIndexedMembers
->mapWithCoords
)StructureName
, removeOriginalName