Added Map.Maps with Neighbourfunction

This commit is contained in:
jbetzend 2014-04-18 16:07:51 +02:00
parent ee8c91237c
commit ebae8dd593

14
src/Map/Maps.hs Normal file
View File

@ -0,0 +1,14 @@
module Map.Maps
where
import Map.Types
-- potentially to be expanded to Nodes
giveNeighbours :: (Int, Int) -> [(Int,Int)]
giveNeighbours (x,y) = filter (not . negative) all
where
all = if even y then [(x+1,y), (x-1,y), (x,y+1), (x,y-1), (x+1,y+1), (x+1,y-1)]
else [(x+1,y), (x-1,y), (x,y+1), (x,y-1), (x-1,y+1), (x-1,y-1)]
negative :: (Int, Int) -> Bool
negative (x,y) = x < 0 || y < 0