A Rubik’s Cube is covered with 54 square areas called facelets, 9 facelets on each of its six sides. Each facelet has a certain color. Usually when the cube is in its starting state, all facelets belonging to one side have the same color. For the original cube these are red, yellow, green, blue, white and orange.
The positions of the facelets can be changed by turning the sides of the cube. This moves nine "little cubes" together with their attached facelets into a new position (see Fig. 1).
The problem is to determine how the facelets of the entire cube are colored after turning different sides in different directions.
The starting state describes the colors of the facelets and where they are positioned. The colors are identified by single characters, and one character is given per facelet. Characters are separated by blanks and arranged in a certain pattern (see Fig. 2). The pattern identifies all six sides of the cube and can be thought of as a folding pattern. As shown in Fig. 2, the description of the top side of the cube is placed right over the description of the front side. This is done by indenting the lines with blanks. The next three lines contain the descriptions of the left, front, right and back side as shown in Fig. 2. The descriptions are simply concatenated with a blank character used as separator. After that the description of the bottom side follows, using the same format as the one used to describe the top side. This concludes the description of the starting state.
Then follows the second section of the scenario containing the turns which have to be performed. The description of the turns starts with a line containing the number of turns t (t > 0). Each turn is given in a separate line and consists of two integer values s and d which are separated by a single blank. The first value s determines the side of the cube which has to be turned. The sides are serially numbered as follows:left ’0′, front ’1′, right ’2′, back ’3′, top ’4′, bottom ’5′. The second value d determines in which direction
the side s has to be turned and can either be ’1′ or ‘-1′. A ’1′ stands for clockwise and a ‘-1′ for counterclockwise.The direction is given under the assumption that the viewer is looking directly at the specific side of the cube.
2 w w w w w w w w w r r r g g g b b b o o o r r r g g g b b b o o o r r r g g g b b b o o o y y y y y y y y y 2 3 1 0 -1 g b b g w w g w w r r r y g g b b y o o w r r r y g g b b y o o w w w w r g g b b y o o b o y y o y y o r r 2 0 1 3 -1
Scenario #1: g b b g w w g w w r r r y g g b b y o o w r r r y g g b b y o o w w w w r g g b b y o o b o y y o y y o r r Scenario #2: w w w w w w w w w r r r g g g b b b o o o r r r g g g b b b o o o r r r g g g b b b o o o y y y y y y y y y