Files

43 lines
508 B
Plaintext

Rotation
========
original 3x3
[1 2 3]
[4 5 6]
[7 8 9]
rotateClockwise
[7 4 1]
[8 5 2]
[9 6 3]
rotateCounterClockwise
[3 6 9]
[2 5 8]
[1 4 7]
rotate180
[9 8 7]
[6 5 4]
[3 2 1]
rotateClockwiseInPlace (transpose, then reverse each row)
[7 4 1]
[8 5 2]
[9 6 3]
rotateClockwiseLayers (four-cell moves)
[7 4 1]
[8 5 2]
[9 6 3]
both in-place versions equal rotateClockwise: true
rectangular 2x3 rotated clockwise becomes 3x2 (in-place is impossible: the shape changes)
[1 2 3]
[4 5 6]
->
[4 1]
[5 2]
[6 3]