Many games, tricks and puzzles depend on determining whether two patterns on a rectangular grid are the ``same'' or not. For instance, the 96 different ways of arranging 8 queens safely on a chessboard can be shown to consist of rotations and/or reflections of only 12 basic patterns.
Write a program that will read in pairs of patterns and determine
whether there is a simple transformation that will convert one into
the other. Because symmetrical patterns bear many relationships to
each other, the transformations must be checked in a specific order.
The possible transformations (in order) are:
Preservation | The patterns are identical |
90 degree rotation | The pattern was rotated clockwise by 90 degrees |
180 degree rotation | The pattern was rotated clockwise by 180 degrees |
270 degree rotation | The pattern was rotated clockwise by 270 degrees |
Reflection | The pattern was reflected about the horizontal axis (effectively by a mirror held at the top of the pattern) |
Combination | A reflection (as above), followed by one of the above rotations |
Improper | The patterns do not match under any of the above transformations |
5 x...x ....x .x... ...x. ...x. .x... ..x.x ..x.. ....x xx..x 2 x. xx x. xx 4 ..x. ...x xx.. .... .... xx.. ...x ..x. 4 .x.. ..x. .x.x x... .... ..xx ..x. .... 0
Rotated through 90 degrees Improper Reflected Reflected and rotated through 270 degrees