Many thanks
lattica: for correcting to multiples of 4
brewbuck for the prob decomposition
iMalc for the restraint in not quite spoonfeeding me :-D
OK .. so now I can generate my matrix-travelling-by-differential-index sequence func:
Code:
int DM=8;
int f, g;
i=0;
while (i<32) {
f = (i%DM+(DM-1))/DM;
g = 1-((i/DM)%2)*2;
printf("%2i ", f*g);
++i;
}
printf("\n");
i=0;
while (i<32) {
printf("%2i ", (1 - (i%DM)+DM-1)/DM);
++i;
}
printf("\n");
This gets
Code:
0 1 1 1 1 1 1 1 0 -1 -1 -1 -1 -1 -1 -1 0 1 1 1 1 1 1 1 0 -1 -1 -1 -1 -1 -1 -1
1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0
so I move sideways first, reaching the end I pop down a row and move leftwards.
The very first step is incorrect so I will jump that one. Obviously workable, but not hugely elegant.
I think to get cuter code it would seem that there may be a bit fiddling recipe for this, but it's good for now.
Many thanks you guys!