2014-04-22 03:00:39 +02:00
|
|
|
module Map.Map where
|
2014-04-18 16:07:51 +02:00
|
|
|
|
|
|
|
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
|