License | BSD-3-Clause |
---|---|
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
Synopsis
- newtype WorldPalette e = WorldPalette {
- unPalette :: KeyMap (AugmentedCell e)
- type TerrainWith a = (TerrainType, Erasable a)
- cellToTerrainPair :: CellPaintDisplay -> TerrainWith EntityFacade
- toCellPaintDisplay :: Cell -> CellPaintDisplay
- toKey :: TerrainWith EntityFacade -> TerrainWith EntityName
- getUniqueTerrainFacadePairs :: [[CellPaintDisplay]] -> Map (TerrainWith EntityName) (TerrainWith EntityFacade)
- constructPalette :: [(Char, TerrainWith EntityFacade)] -> KeyMap CellPaintDisplay
- constructWorldMap :: [(Char, TerrainWith EntityFacade)] -> [[CellPaintDisplay]] -> Text
- genericCharacterPool :: Set Char
- prepForJson :: WorldPalette EntityFacade -> [[CellPaintDisplay]] -> (Text, KeyMap CellPaintDisplay)
Documentation
newtype WorldPalette e Source #
A world palette maps characters to PCell
values.
WorldPalette | |
|
Instances
Show e => Show (WorldPalette e) Source # | |
Defined in Swarm.Game.Scenario.Topography.WorldPalette showsPrec :: Int -> WorldPalette e -> ShowS # show :: WorldPalette e -> String # showList :: [WorldPalette e] -> ShowS # | |
Eq e => Eq (WorldPalette e) Source # | |
Defined in Swarm.Game.Scenario.Topography.WorldPalette (==) :: WorldPalette e -> WorldPalette e -> Bool # (/=) :: WorldPalette e -> WorldPalette e -> Bool # | |
FromJSONE (EntityMap, RobotMap) (WorldPalette Entity) Source # | |
Defined in Swarm.Game.Scenario.Topography.WorldPalette parseJSONE :: Value -> ParserE (EntityMap, RobotMap) (WorldPalette Entity) Source # parseJSONE' :: (EntityMap, RobotMap) -> Value -> Parser (WorldPalette Entity) Source # |
type TerrainWith a = (TerrainType, Erasable a) Source #
getUniqueTerrainFacadePairs :: [[CellPaintDisplay]] -> Map (TerrainWith EntityName) (TerrainWith EntityFacade) Source #
We want to identify all of the unique (terrain, entity facade) pairs. However, EntityFacade includes a Display record, which contains more fields than desirable for use as a unique key. Therefore, we extract just the entity name for use in a (terrain, entity name) key, and couple it with the original (terrain, entity facade) pair in a Map.
constructPalette :: [(Char, TerrainWith EntityFacade)] -> KeyMap CellPaintDisplay Source #
constructWorldMap :: [(Char, TerrainWith EntityFacade)] -> [[CellPaintDisplay]] -> Text Source #
genericCharacterPool :: Set Char Source #
All alphanumeric characters. These are used as supplemental map placeholders in case a pre-existing display character is not available to re-use.
prepForJson :: WorldPalette EntityFacade -> [[CellPaintDisplay]] -> (Text, KeyMap CellPaintDisplay) Source #
Note that display characters are not unique across different entities! However, the palette KeyMap as a conveyance serves to dedupe them.