tracer/src/Types/Map.hs

61 lines
1.1 KiB
Haskell
Raw Normal View History

2018-03-03 16:03:17 +00:00
{-# LANGUAGE FlexibleInstances #-}
module Types.Map where
data TileState
= Wall
-- | Wind
| Door
| Hall
| Offi
| Toil
| Kitc
| Elev
| Unde
2018-03-03 16:03:17 +00:00
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
2018-03-03 16:03:17 +00:00
{ fcElevator :: (Int, Int)
, fcFacilities :: [(Int, Int)]
, fcSize :: (Int, Int)
} deriving (Show)
2018-03-03 16:03:17 +00:00
data Boundaries a = Boundaries
{ matmin :: (a, a)
, matmax :: (a, a)
} deriving (Show, Eq)
2018-03-03 16:03:17 +00:00
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)]
2018-03-03 16:03:17 +00:00
, bounds :: Boundaries Int
}
deriving (Show, Eq)
2018-03-03 16:03:17 +00:00
class Size a where
size :: a -> Double