swarm-0.5.0.0: 2D resource gathering game with programmable robots
LicenseBSD-3-Clause
Safe HaskellSafe-Inferred
LanguageHaskell2010

Swarm.Game.Scenario.Topography.Structure

Description

Definitions of "structures" for use within a map, as well as logic for combining them.

Synopsis

Documentation

data PStructure c Source #

Constructors

Structure 

Fields

overlaySingleStructure :: Map StructureName (PStructure (Maybe a)) -> (Placement, PStructure (Maybe a)) -> MergedStructure (Maybe a) -> MergedStructure (Maybe a) Source #

Destructively overlays one direct child structure upon the input structure. However, the child structure is assembled recursively.

mergeStructures :: Map StructureName (PStructure (Maybe a)) -> Maybe Placement -> PStructure (Maybe a) -> MergedStructure (Maybe a) Source #

Overlays all of the "child placements", such that the children encountered earlier in the YAML file supersede the later ones (due to use of foldr instead of foldl).

paintMap :: MonadFail m => Maybe Char -> WorldPalette e -> Text -> m ([[Maybe (PCell e)]], [Waypoint]) Source #

"Paint" a world map using a WorldPalette, turning it from a raw string into a nested list of PCell values by looking up each character in the palette, failing if any character in the raw map is not contained in the palette.

readMap :: Applicative f => (Char -> f b) -> Text -> f [[b]] Source #