# Randomly solving a rubik’s cube with only one face given

Given only one face of the rubik's cube, is there any way to form the other faces randomly so we end up with valid solvable configuration?

Let’s suppose that I have an input which is only one face of the Rubik's cube stickers of only one face.

Let’s also say that input will be like follows:

"wrggyrgbo" the 9 stickers of the upper face _ consider the yellow as the upper_

The output should be a complete form of the solvable Rubik's cube stickers
like this:

wrggyrgbobyrobbggrwybyrwyobyyorgwwwyybroobrgwgyorwgoob"

Lastly, there is the notation considerations:

Y up
B left
R front
G right
O back
W down

Sure.

You should start with a list of the small cubies (red-blue-white corner, green-yellow side, orange center, etc), and make a random configuration with the one required side in place.

Then, you must guard against the three possible parity errors that can cause an invalid scramble:

1. The total amount of twisting that the corners need must be sum up to zero (modulo full rotations)
2. The total number of required edge flips must be even
3. The total number of required piece swaps must be even

One way (definitely not the most efficient, but probably simplest to grasp and easiest to program, at least if you have a working solver handy) is to take the original fully random configuration, and generate all the 12 possible variations that can be formed as combinations of the possibilities:

(twist some corner piece 0/120/240 degrees) $$\times$$ (flip some edge piece or not) $$\times$$ (swap some two pieces or not)

and if you then run all the twelve variations through a solver, exactly one of them will be solvable.

• -- take origianlly fully random configuration __ all I have is one face of cube___ – jahly Feb 27 '20 at 16:32
• @jahly, a Rubik's cube is made of 3x3x3=27 little "cubies". There are 8 corner cubies (with 3 visible sides), 12 edge cubies (2 visible sides), and the "center piece" (the 6 centers of the faces and the hidden piece at the center of the cube come in one piece.) Out of these 21 parts, you first build the face you have, selecting suitable cubies randomly. Then you randomly add the rest of the parts to complete the cube. Then you make the 12 variants described above, and try to solve them. The variant that was solvable is a valid, randomised cube that has the one desired face in place. – Bass Feb 27 '20 at 19:24