{-# LANGUAGE FlexibleInstances #-} module Types.Map where data TileState = Wall -- | Wind | Door | Hall | Offi | Toil | Kitc | Elev | Unde deriving (Ord, Eq) instance Show TileState where show Wall = "#" -- show Wind = "~" show Door = "+" show Hall = "_" show Offi = "." show Toil = "o" show Kitc = "k" show Elev = "x" show Unde = " " data FloorConfig = FloorConfig { fcElevator :: (Int, Int) , fcFacilities :: [(Int, Int)] , fcSize :: (Int, Int) } deriving (Show) data Boundaries a = Boundaries { matmin :: (a, a) , matmax :: (a, a) } deriving (Show, Eq, Ord) instance Size (Boundaries Int) where size (Boundaries (minr, minc) (maxr, maxc)) = fromIntegral ((maxr - minr) * (maxc - minc)) instance Size (Boundaries Double) where size (Boundaries (minr, minc) (maxr, maxc)) = (maxr - minr) * (maxc - minc) data GraphDirection = North | South | East | West deriving (Show, Eq) data Graph = GHall { connects :: [Graph] } | GRoom { neighbs :: [(GraphDirection, TileState)] , bounds :: Boundaries Int } deriving (Show, Eq) graphIsRoom :: Graph -> Bool graphIsRoom (GRoom _ _) = True graphIsRoom _ = False class Size a where size :: a -> Double