diff options
Diffstat (limited to 'users/glittershark/xanthous/src/Xanthous/Data.hs')
-rw-r--r-- | users/glittershark/xanthous/src/Xanthous/Data.hs | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/users/glittershark/xanthous/src/Xanthous/Data.hs b/users/glittershark/xanthous/src/Xanthous/Data.hs index 67173cc89646..031815b8fba4 100644 --- a/users/glittershark/xanthous/src/Xanthous/Data.hs +++ b/users/glittershark/xanthous/src/Xanthous/Data.hs @@ -79,8 +79,17 @@ module Xanthous.Data , edges , neighborDirections , neighborPositions + , neighborCells , arrayNeighbors , rotations + , HasTopLeft(..) + , HasTop(..) + , HasTopRight(..) + , HasLeft(..) + , HasRight(..) + , HasBottomLeft(..) + , HasBottom(..) + , HasBottomRight(..) -- * , Hitpoints(..) @@ -439,6 +448,9 @@ neighborDirections = Neighbors neighborPositions :: Num a => Position' a -> Neighbors (Position' a) neighborPositions pos = (`move` pos) <$> neighborDirections +neighborCells :: Num a => (a, a) -> Neighbors (a, a) +neighborCells = map (view _Position) . neighborPositions . review _Position + arrayNeighbors :: (IArray a e, Ix i, Num i) => a (i, i) e |