    # All documentations for the program "Best Virtual Rubik's Cube"

Manual

How to write scripts

How to solve?

## How to solve a Rubik's Cube? Step-by-step instruction

In this article described a simple method to solve Rubik's Cube 3x3x3, illustrated by video and scripts for the program "Best Virtual Rubik's Cube".

In a short time step-by-step instruction how to solve Rubik's Cube 2x2x2, 4x4x4, 5x5x5 etc. will be here. Please wait little!

### Notations

The pieces that compose the Rubik's Cube are called cubies. There are three types of cubies:
The center pieces, at the center of each face of the Rubik's Cube.
The corner pieces, at the corners of the Rubik's Cube.
The edge pieces, between each pair of adjacent center pieces.

The first layer is a layer, from which you started to restore Rubik's Cube to its original configuration, the third is the opposite, and the second is the middle one. In all illustrations below the first layer is lower.

• Step 1. Place in their correct position the four edge pieces of first layer. - Solve the cross.
• Step 2. Place in their correct position the four corner pieces of first layer. - First layer completed.
• Step 3. Place in their correct position the four edge pieces of second layer. - Second layer completed.
• Step 4. Place in their correct position the four edge pieces of third layer. - First stage.
• Step 5. Place in their correct position the four edge pieces of third layer. - Second stage.
• Step 6. Place in their correct position the four corner pieces of third layer. - First stage.
• Step 7. Place in their correct position the four corner pieces of third layer. - Second stage. Rubik's Cube solved.

Please see all 7 Steps in one video:

Also you can look through seven small (1-2 min.) videos for each step. (Links see below.)

### Step 1. Place in their correct position the four edge pieces of first layer.

The first step is very easy.

Choose any face of Rubik's Cube to start with. It is a good idea to choose layer in which one or more pieces, by chance is already in their correct position.

If the edge piece you want to place is in the third layer and the color of one of its faces the same as color the center piece you just have to make turn the side face of Rubik's Cube with the selected piece 180 degrees (see figure below - the first layer is selected the red face of Rubik's Cube, placing red-green piece). If the edge piece you want to place is in the third layer, but the color of any of its faces do not match with color the central piece then it have to moved into the second layer, so that the color of one of its faces coincide with the color of the central piece, and only then move it to the first layer. If the edge piece you want to place is in the first layer, but its colors do not match with the colors of the adjacent central pieces you have to move it to the second layer, turning the side face of the Rubik's Cube 90 degrees. Then turn 90 degrees the first layer and move the placing piece from the second layer in the first turned the other side face of the Rubik's Cube 90 degrees. If the edge piece you need to place is in the second layer, it should be immediately set into its place in the first layer, turning 90 degrees to one of the sides of the Rubik's Cube. You have to first rotate the first of the Rubik's Cube to place the piece in the correct position. If the piece is in the first layer, but not in its correct position, it have to move in the second or third layer and set into its place, using the above-mentioned methods.

### Step 2. Place in their correct position the four corner pieces of first layer.

If the corner piece of the first layer is not already in its place in the correct position, then possible two situations:

1. Corner piece is located in the third layer, in three different positions "a", "b", "c" (see picture below).
2. Corner piece is located in the first layer, is not in its place or located in its place, but the colors its faces do not match with the color of the neighboring pieces. If the corner piece you need to place is in the third layer, in the position "a", then set it in its correct position may following script: ``` 3
(Y3+1)
(Z3+1)
(Y3-1)
(Z3-1)
```

If the corner piece you want to place is in the third layer, in the position "b", then set it in its correct position may following script:

``` 3
(Y3-1)
(X3-1)
(Y3+1)
(X3+1)
```

That is, in this case, the third layer of the Rubik's Cube must be turned in the opposite direction and afterwards to set the piece in the correct position, turn the other face of the Rubik's Cube.

Please note that all scripts will work correctly if and only if the side of Rubik's Cube oriented with respect to XYZ axes the same as in the picture. Also you have to select "Script for current Rubik's Cube" options.

If you're solving a real Rubik's Cube and you want to co-ordinate the rotation of the layers of Virtual Rubik's Cube with the real one, then in the Options dialog panel, reduce the speed of Slices rotation to a minimum.

To make the Rubik's Cube desired orientation relative to the axes XYZ, just rotate at once the three layers of Rubik's Cube. Or - it is more interesting - do write a new script yourself.

If the corner piece you want to place is in the third layer, in the position "c", it have to set to "a" or "b" position and only after that to set its in the correct place in the first layer. Here are examples of two scripts that perform this operation:

 ``` 3 (Z3+1) (Y3-1) (Z3-1) (X3-1) (Y3+2) (X3+1) ``` ``` 3 (X3-1) (Y3+1) (X3+1) (Z3+1) (Y3+2) (Z3-1) ```

The picture shows the execution of the first of the above described scenarios: If the corner piece you want to place located in the first layer is not in its place or located in its place, but the colors its faces do not match with the color of the neighboring pieces, then you have to move it to the third layer of the Rubik's Cube, and try to make it so to the corner piece immediately set in the position "a" or "b" and then apply the appropriate algorithm described above.

### Step 3. Place in their correct position the four edge pieces of second layer.

If the edge piece of second layer is not in its correct position, then there are 3 following case:

1. The piece is in the third layer.
2. The piece is in the second layer, but not in its correct place.
3. The piece is already in its place in the second layer, but the colors do not match with the colors of the nearby central pieces.

If the edge piece you want to place located in the third layer, it can be in two positions, as shown in the picture below (here set the yellow-green edge piece). Nearby are the scripts after execution setting the edge pieces in their correct position: ```3 (Y3-1) (X3-1) (Y3+1) (X3+1) (Y3+1) (Z3+1) (Y3-1) (Z3-1) ``` ```3 (Y3+1) (Z3+1) (Y3-1) (Z3-1) (Y3-1) (X3-1) (Y3+1) (X3+1) ```

If the piece is in the second layer, then it should be moved to the third layer and after it you have to make the one of described above operation. The picture below: on the left the edge piece is in the second layer, but not in its place, and on the right it is in its place, but its colors do not match with colors of the adjacent central piece. After execution of scripts pieces will place in their correct positions and orientations.

Once again: please note that all scripts will work correctly if and only if the side of Rubik's Cube oriented with respect to XYZ axes the same as in the picture. Also do not forget to choose "Script for current Rubik's Cube" options. ```3 (X3+1) (Y3-1) (X3-1) (Y3-1) (Z1+1) (Y3+1) (Z1-1) (Y3+1) (Y3+1) (Z3+1) (Y3-1) (Z3-1) (Y3-1) (X3-1) (Y3+1) (X3+1) ``` ```3 (Z3+1) (Y3-1) (Z3-1) (Y3-1) (X3-1) (Y3+1) (X3+1) (Y3+2) (Y3+1) (Z3+1) (Y3-1) (Z3-1) (Y3-1) (X3-1) (Y3+1) (X3+1) ```
Your Rubik's Cube should now have the first two layers complete!

### Step 4. Place in their correct position the four edge pieces of third layer. First stage.

At this stage we will place edge pieces of the third layer in their correct position, regardless of their orientation. If all edge pieces are already in their place, but the colors of their faces did not match with colors of the adjacent central pieces - just go to the next step.

So, if the edge pieces of the third do not stand in their correct position, then there are two case:

1. Two adjacent edge pieces are not in place, the other two in its place (see Fig. below left).
2. All 4 edge pieces are in incorrect position, and each cube takes the place of a neighbor. (see Fig. below right).

In both cases, to place the pieces used the same algorithm, only in the first case, the script is executed once, and in the second one - twice. ```3 (Y3-1) (X3-1) (Z1+1) (Y3-1) (Z1-1) (Y3+1) (X3+1) ``` ```3 (Y3-1) (X3-1) (Z1+1) (Y3-1) (Z1-1) (Y3+1) (X3+1) (Y3+1) (X3-1) (Z1+1) (Y3-1) (Z1-1) (Y3+1) (X3+1) (Y3+2) ```

In the second case, instead of moving four pieces you can rearrange only three nearby edgy pieces. Here are two interesting scripts that do such a circular permutation of three edge pieces: ```3 (X2+1) (Y3-1) (X2-1) (Y3-2) (X2+1) (Y3-1) (X2-1) ``` ```3 (X2+1) (Y3+1) (X2-1) (Y3+2) (X2+1) (Y3+1) (X2-1) ```

### Step 5. Place in their correct position the four edge pieces of third layer. - Second stage.

Now when all the edge pieces of the third layer are on their place, it is necessary to agree of their colors with the colors of the adjacent central pieces. If all edge pieces are right oriented, go to the next step.

There may be three cases:

1. Two adjacent edge pieces are oriented incorrectly.
2. Two opposite edge pieces oriented incorrectly.
3. All four edge pieces are oriented incorrectly.

In all cases, used the same algorithm, and the first and the second case it is applied twice, and the third case it is applied four times. Here's a script that demonstrates this algorithm:

```3
(X3-1)(Y2+1)(X3-1)(Y2+1)(X3-1)(Y2+1)(X3-1)(Y2+1)
```

It is important to note that the script should be executed for all the pieces with the same point, that is, after each execution of the script you should not turn the whole Rubik's Cube, but substituted another, incorrectly oriented piece, turning third layer. The first case:```3 (X3-1)(Y2+1)(X3-1)(Y2+1)(X3-1)(Y2+1)(X3-1)(Y2+1) (Y3+1) (X3-1)(Y2+1)(X3-1)(Y2+1)(X3-1)(Y2+1)(X3-1)(Y2+1) (Y3-1)``` The second case:```3 (X3-1)(Y2+1)(X3-1)(Y2+1)(X3-1)(Y2+1)(X3-1)(Y2+1) (Y3+2) (X3-1)(Y2+1)(X3-1)(Y2+1)(X3-1)(Y2+1)(X3-1)(Y2+1) (Y3+2)``` The third case:```3 (X3-1)(Y2+1)(X3-1)(Y2+1)(X3-1)(Y2+1)(X3-1)(Y2+1) (Y3+1) (X3-1)(Y2+1)(X3-1)(Y2+1)(X3-1)(Y2+1)(X3-1)(Y2+1) (Y3+1) (X3-1)(Y2+1)(X3-1)(Y2+1)(X3-1)(Y2+1)(X3-1)(Y2+1) (Y3+1) (X3-1)(Y2+1)(X3-1)(Y2+1)(X3-1)(Y2+1)(X3-1)(Y2+1) (Y3+1)```

### Step 6. Place in their correct position the four corner pieces of third layer. - First stage.

Now we will set in their correct position the four corner pieces of third layer. Their orientation does not matter at this stage. They will be oriented correctly at the next step.

The simplest case - when all four corner pieces stand in the opposite corner. The following script produces rearrangement four corner pieces: ```3
(X2+2)
(Y1+2)
(X2+2)
(Y1+1)
(Z2+2)
(Y1+2)
(Z2+2)
(Y3+2)
(Y1-1)
```

If you need to swap two adjacent corner pieces, it is easier to use two versions of the same algorithm, and to use of each version should be twice and both times to start from the same point. Here are scripts that illustrate the operation of these algorithms: ```3 (Z3-1)(X3-1)(Z3+1)(X3+1) (Z3-1)(X3-1)(Z3+1)(X3+1) (Z3-1)(X3-1)(Z3+1)(X3+1) ``` ```3 (X3+1)(Z3+1)(X3-1)(Z3-1) (X3+1)(Z3+1)(X3-1)(Z3-1) (X3+1)(Z3+1)(X3-1)(Z3-1) ```

The following are examples of using these scripts in practice: ```3 (Z3-1)(X3-1)(Z3+1)(X3+1) (Z3-1)(X3-1)(Z3+1)(X3+1) (Z3-1)(X3-1)(Z3+1)(X3+1) (Y3-1) (Z3-1)(X3-1)(Z3+1)(X3+1) (Z3-1)(X3-1)(Z3+1)(X3+1) (Z3-1)(X3-1)(Z3+1)(X3+1) (Y3+1) ``` ```3 (X3+1)(Z3+1)(X3-1)(Z3-1) (X3+1)(Z3+1)(X3-1)(Z3-1) (X3+1)(Z3+1)(X3-1)(Z3-1) (Y3+1) (X3+1)(Z3+1)(X3-1)(Z3-1) (X3+1)(Z3+1)(X3-1)(Z3-1) (X3+1)(Z3+1)(X3-1)(Z3-1) (Y3-1) ``` ```3 (Z3-1)(X3-1)(Z3+1)(X3+1) (Z3-1)(X3-1)(Z3+1)(X3+1) (Z3-1)(X3-1)(Z3+1)(X3+1) (Y3+2) (Z3-1)(X3-1)(Z3+1)(X3+1) (Z3-1)(X3-1)(Z3+1)(X3+1) (Z3-1)(X3-1)(Z3+1)(X3+1) (Y3+2) ``` ```3 (X3+1)(Z3+1)(X3-1)(Z3-1) (X3+1)(Z3+1)(X3-1)(Z3-1) (X3+1)(Z3+1)(X3-1)(Z3-1) (Y3+2) (X3+1)(Z3+1)(X3-1)(Z3-1) (X3+1)(Z3+1)(X3-1)(Z3-1) (X3+1)(Z3+1)(X3-1)(Z3-1) (Y3+2) ```

Note that two latter cases are equivalent, and can be solved by any of the above described two scripts.

### Step 7. Place in their correct position the four corner pieces of third layer. - Second stage.

At the last stage all the four corner pieces will be oriented correctly.

Here are two scripts that illustrate the versions of the same algorithm changes orientation of the corner piece. In the first case it make the "turn" the corner piece clockwise in the second case - counter-clockwise.

If you need to "turn" the three corner pieces in the same direction, one of the scripts is performed three times in a row.

If the corner piece need to turn in different directions, then both of the scripts execute alternately, two or four times.

As always, the script must be executed from the same point! ```3 (X3-1)(Z3+1)(X3+1)(Z3-1) (X3-1)(Z3+1)(X3+1)(Z3-1) ``` ```3 (Z3+1)(X3-1)(Z3-1)(X3+1) (Z3+1)(X3-1)(Z3-1)(X3+1) ```

The following are examples of using these scripts in practice. In the first and second cases they make the "turn" two corner pieces, in the third and fourth cases - three corner pieces, and the third case - in a clockwise direction, while in the fourth case - counter-clockwise.

If you need to "turn" once the four corner pieces, execute the first or second script twice. ```3 (X3-1)(Z3+1)(X3+1)(Z3-1) (X3-1)(Z3+1)(X3+1)(Z3-1) (Y3+1) (Z3+1)(X3-1)(Z3-1)(X3+1) (Z3+1)(X3-1)(Z3-1)(X3+1) (Y3-1) ``` ```3 (Z3+1)(X3-1)(Z3-1)(X3+1) (Z3+1)(X3-1)(Z3-1)(X3+1) (Y3+1) (X3-1)(Z3+1)(X3+1)(Z3-1) (X3-1)(Z3+1)(X3+1)(Z3-1) (Y3-1) ``` ```3 (X3-1)(Z3+1)(X3+1)(Z3-1) (X3-1)(Z3+1)(X3+1)(Z3-1) (Y3+1) (X3-1)(Z3+1)(X3+1)(Z3-1) (X3-1)(Z3+1)(X3+1)(Z3-1) (Y3+1) (X3-1)(Z3+1)(X3+1)(Z3-1) (X3-1)(Z3+1)(X3+1)(Z3-1) (Y3+2) ``` ```3 (Z3+1)(X3-1)(Z3-1)(X3+1) (Z3+1)(X3-1)(Z3-1)(X3+1) (Y3+1) (Z3+1)(X3-1)(Z3-1)(X3+1) (Z3+1)(X3-1)(Z3-1)(X3+1) (Y3+1) (Z3+1)(X3-1)(Z3-1)(X3+1) (Z3+1)(X3-1)(Z3-1)(X3+1) (Y3+2) ```

Congratulations! You have solved your Rubik's Cube!