Quote Originally Posted by yorki View Post
Thanks for all your help.

coordinates solution works as a treat.

Still there is one request
if you can point me toward literature related to array or array indexing or coordinate calculation that would be grate help.

(your way of getting coordinates is simplest i have came across so far, and it never appeared in any searches i did before)


Thanks
I don't know if I've come across it anywhere as such in the coordinate context. It's the same "odometer"-style algorithm that's used for lots of counting things, where one "dimension" keeps ticking up, and then once it reaches its limit causes the next number to "roll over".

It's also how you do base conversions (although there the numbers stay the same each time) -- for instance, to convert 777 to base 8, you start by doing 777%8 = 1 (which is the last number), 777/8=97, 97%8 = 1 (the second-to-last number), 97/8=12, 12%8=4, 12/8=1, 1%8=1. So 777 is 01411. (This is where I internalized it from, although I don't know that I've seen it printed as such somewhere.)