-
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.
eliminate remaining Cell dependence in structure recognizer (#2114)
Builds upon #1836. Ultimately, this allows us to move the final remaining module, `Precompute.hs`, into the `swarm-topology` sublibrary to live alongside the rest of the structure recognizer code. ## Also in this PR * improve logging details for shape recognition
- Loading branch information
Showing
20 changed files
with
228 additions
and
156 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
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
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
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
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
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
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
28 changes: 28 additions & 0 deletions
28
src/swarm-topography/Swarm/Game/Scenario/Topography/Structure/Named.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
-- | | ||
-- SPDX-License-Identifier: BSD-3-Clause | ||
module Swarm.Game.Scenario.Topography.Structure.Named where | ||
|
||
import Data.Set (Set) | ||
import Data.Text (Text) | ||
import Swarm.Game.Scenario.Topography.Grid (Grid) | ||
import Swarm.Game.Scenario.Topography.Placement (StructureName) | ||
import Swarm.Language.Syntax.Direction (AbsoluteDir) | ||
|
||
data NamedArea a = NamedArea | ||
{ name :: StructureName | ||
, recognize :: Set AbsoluteDir | ||
-- ^ whether this structure should be registered for automatic recognition | ||
-- and which orientations shall be recognized. | ||
-- The supplied direction indicates which cardinal direction the | ||
-- original map's "North" has been re-oriented to. | ||
-- E.g., 'DWest' represents a rotation of 90 degrees counter-clockwise. | ||
, description :: Maybe Text | ||
-- ^ will be UI-facing only if this is a recognizable structure | ||
, structure :: a | ||
} | ||
deriving (Eq, Show, Functor) | ||
|
||
isRecognizable :: NamedArea a -> Bool | ||
isRecognizable = not . null . recognize | ||
|
||
type NamedGrid c = NamedArea (Grid c) |
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
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.