|
|
|
|
|
by lucker
3456 days ago
|
|
Umm... or, I could just rotate a square a quarter-turn by iterating over the square's elements: for (x = 0; x < N; x ++) {
for (y = 0; y < N; y ++) {
newSquare[x][y] = oldSquare[y][N-1-x];
}
} Of course, in certain representations of the square (such as using a 1-d array) even simpler algorithms can be used. |
|