Well it might help to forget the z element all together, as each x, and each y can have a value, so can each x, and y combined.
Another thing you could do is use a nested loop.
->on start of layout
-->loop "x" = 0 to 64
--->loop "y" = 0 to 48
---->array compare value at loopindex(x), loopindex(y) =1
----->do stuff at loopindex(x), loopindex(y) * 10
That's essentially what the for each in array does.
Note, the array object is 1 based, in other words it does not start at zero, so a loop may actually be easier to use instead of current array -1.
Then you have to add 1 to loopindex to compensate.
But I wouldn't worry about that till you get the gist of it.
Just remember that x, and y are coordinates that can have a value, besides it position.