I have a two-dimensional array, say
0 0 0 0 0
0 2 3 4 0
0 9 1 5 0
0 8 7 6 0
0 0 0 0 0
And i need to get all the numbers adjacent to 1(2, 3, 4, 5, 6, 7, 8, 9)
Is there a less ugly solution than:
topLeft = array[x-1][y-1]
top = array[x][y-1]
topRight = array[x+1][y-1]
# etc
Thanks!