# Rubik-like Puzzle

The only formula you really need to know is:
P XsX's' P'
If you understand it, you'll never get stuck on the Cube, nor will almost any other Rubik-like puzzle stop you for very long. (It is possible for a puzzle to be reminiscent of Rubik's cube, and yet have properties that don't succumb to this analysis. I haven't actually seen one.)

This document just gives you basic background to turn this kind of puzzle into a puzzle, and stimulate your thinking. It won't give you a mindless formula. It can't give you an optimal solution. It doesn't give you a computer algorithm. It isn't mathematically rigorous. It simply enables you to think about the puzzle as a puzzle, and solve it.

## Forethoughts

The tough thing about Rubik-like puzzles is that the most basic operation, the turning of a slice, moves a large fraction of the pieces of the puzzle at one time. If there is any hope of finding a solution that a human can understand, you must find some way to move just a few pieces at a time, without disturbing the rest. You need a formula to find this kind of combination of moves.

The most convenient series of moves would rotate a single piece or exchange two pieces. But can you just exchange two pieces, without exchanging another pair, or rotate just one piece without rotating another the opposite way? It depends on the puzzle. It turns out that you generally want to be restricted to doing two simultaneous exchanges or two simultaneous rotations, for reasons that will become clear later.

Let us define the exchange-number of a cube as the minimum number of two-piece exchanges that it would take to put all pieces in the right place. We'll ignore rotations for now.

We defined exchange-number mostly just to help define parity. Parity is said to be even if the exchange-number is even, and odd if the exchange-number is odd. This is important, because while you may be able to undo a certain number of exchanges using a different number of exchanges, those two numbers must both be even, or both odd. You cannot undo an odd number of exchanges with an even number of exchanges, or vice versa.

Some puzzles, such as the Pyraminx, always conserves even parity. A 2x2x2 cube, however, can have even or odd parity. Here's how you can tell:

Examine all the fundamental moves. A Pyraminx has 3 pieces on a slice; here is a clockwise rotation:

A            B
->
B   C        C   A

Then look at the same transformation, when done by exchanges:

B             B
=     /       +
A   C         C---A

Thus, the only fundamental operation does a double-exchange, changing the exchange-number by 2 - therefore, parity is always even. It is easy to see, then, why 4 pieces on a slice will not conserve parity: a quarter-turn is equivalent to 3 piece exchanges.

As I hinted before, you always want to achieve even parity. If you have a puzzle that does not conserve parity, the good news is that one rotation of a non-parity-conserving slice will create even parity. There is more good news: rotational parity (piece orientation) is almost always conserved in Rubik-like puzzles.

## Method

Since you can always achieve even parity with a Rubik-like puzzle, you can always solve one by doing double exchange and double rotation maneuvers. Luckily, there is a simple idea that applies to any of these puzzles, which greatly simplifies the problem.

We want to be able to do a simple double exchange or rotation maneuver without disturbing the rest of the puzzle. To accomplish this goal, we will use the seemingly unrelated fact that it is generally easy to find a maneuver (call it X) that does a single exchange or rotation on pieces on a slice (called s), without disturbing the rest of the slice s, but which disturbs some, or even all of the rest of the puzzle. All of the pieces we wish to exchange or rotate are on s.

It doesn't matter that the rest of the puzzle gets disturbed, because we are going to undo X with exactly the reverse sequence of moves (called X'), but only after we move the other exchange pieces into place by turning slice s. That's the secret.

First, do an exchange (or rotation) maneuver X, then move the exchanged (or rotated) pieces out of position and other pieces into position by moving slice s, then do the inverse exchange (or rotation) maneuver X', which restores the rest of the puzzle while completing the double exchange (or rotation). All that is left to do is move the slice back (s'). Thus we have
XsX's'
What if the pieces that we wish to exchange or rotate are not all located on the same slice? That's easy enough: put them there before you do the maneuver, and when you're done, put them back. This is a prefix operation (P and P'), also known as conjugation. You can use this simple fact to exchange any two pairs (or rotate any two pieces) on the entire puzzle.

## Example

Suppose we are working with a 2x2x2 cube. From the scrambled state, it's relatively simple to solve one half of the puzzle, putting the correct four pieces together on the "top" side. But when we examine the "bottom", we find pieces in the wrong positions:

A   B                           B---A
Correct:              Current situation:
C   D                           C   D

Clearly, we have odd parity. Only pieces A and B need to be exchanged.

Fortunately, we know how to create even parity. Make a quarter turn, either way.

C   B
Even parity:
D   A

B is now in the correct spot, but A, C, and D are incorrect. More specifically, they need to undergo a rotation of 3, which can be accomplished by a double exchange: first, exchange D and A, then exchange A and C. Now, invent any maneuver at all that will exchange D and A, without disturbing C and B, while letting the rest of the cube go to hell. You better write it down, so that you can remember how to reverse it.

C   B
Do an exchange (X):
A---D

The rest of the cube is totally screwed up at this point.

B   D
Rotate left (s):
C   A

That is, rotate the slice! Don't rotate the whole cube in your hand, or you'll ruin the restoration of the rest of the cube.

B   D
Undo exchange (X'):
A---C

The rest of the cube is now restored!

A   B
Rotate right (s'):
C   D

All of the pieces are now in the right places, but some of their rotations may be wrong. But that's okay - you know how to fix it!

Happy puzzling!