I have a two dimensional grid where width and height are always the same.
[0][1][2]
[3][4][5]
[6][7][8]
I reduced it's data source into a one-dimensional array.
[0][1][2][3][4][5][6][7][8]
Access of elements works, but here comes the tricky part: How to know, whether a neighbour of a cell is outside the grid when still processing the one-dimensional array?
For example the upper right neighbour of [5] is out of the grid but using a calculcated offset index, I will get [3].
Anyone with experience in this field?