Complex permutation of elements of an array
I have written two rotation functions that operate on a character array of length equal to a perfect square.
The first rotate n times each odd line to the right and n times each pair line to the left. The second rotates n times each odd column down and n times each pair column up, where n is the numer of current line or column.
I would like to reduce everything to a single function, or rather, to a single loop that moves each character in its final position without performing all the steps.
You can do this? Any suggestions?