Module for getting neighbouring fields of some (x, y). Works with a few different matrix topologies. Topology specifies how neighbours are found across matrix edges.
Given a topology and (x, y) returns array of neighbours from given matrix.
myMatrix = generate 4 4 (\x y -> (String.fromInt x) ++ (String.fromInt y))
-- "00" "10" "20" "30"
-- "01" "11" "21" "31"
-- "02" "12" "22" "32"
-- "03" "13" "23" "33"
neighbours Plane 0 0 myMatix
-- Array.fromList ["01","11","10"]
neighbours Torus 0 0 myMatix
-- Array.fromList ["33","03","13","31","01","11","10","30"]
neighbours stripHorizontal 0 0 myMatrix
-- Array.fromList ["31","01","11","10","30"]
neighbours StripVertical 0 0 myMatix
-- Array.fromList ["03","13","01","11","10"]
Possible topologies