about summary refs log blame commit diff
path: root/src/Xanthous/Entities/Environment.hs
blob: f5301f94adf25710405141f3289a47582679782b (plain) (tree)

























                                                                                
module Xanthous.Entities.Environment
  ( Wall(..)
  ) where
--------------------------------------------------------------------------------
import Xanthous.Prelude
import Test.QuickCheck
import Brick (str)
import Brick.Widgets.Border.Style (unicode)
--------------------------------------------------------------------------------
import Xanthous.Entities (Draw(..), entityIs)
import Xanthous.Entities.Draw.Util
import Xanthous.Data
--------------------------------------------------------------------------------

data Wall = Wall
  deriving stock (Show, Eq, Ord, Generic, Enum)
  deriving anyclass (CoArbitrary, Function)

instance Arbitrary Wall where
  arbitrary = pure Wall

instance Draw Wall where
  drawWithNeighbors neighs _wall =
    str . pure . borderFromEdges unicode $ wallEdges
    where
      wallEdges = any (entityIs @Wall) <$> edges neighs