# Contructing Algorithms (not a how to, sorry)



## jerry (Jan 1, 2011)

Lately I've been interested in understanding more about the cube. I learned the Heise method a while back and was quite happy with it. I like the idea of using commutators to solve certain situations on the spot. However, from my understanding you can't use a commutator to swap two edges and two corners at once (like a T perm would). I don't know any of those permutations because I never bothered memorizing algorithms (I'm not really interested in speed cubing). My goal is to understand how to come up with such permutations on the spot without memorizing them. Is there any method along a vein similar to commutators that could accomplish this?


----------



## aronpm (Jan 1, 2011)

You can do a quarter turn, and then do more commutators.


----------



## Christopher Mowla (Jan 1, 2011)

Yes. I have actually invented a method for creating parity algorithms that can help you to swap two edges and two corners.

For example, the parity algorithm:
r2 B2 U2 l U2 r' U2 r U2 F2 r F2 l' B2 r2

can be written as:

r2 B2 :_Set-up moves_
l F2 :_Set-up moves_
F2 l' :_Set-up moves_
(U2 l U2 r' U2 r U2 l') : _The commutator [U2, l U2 r']._
l F2 :_Set-up moves_
(r) : _The extra quarter turn_
F2 l' :_Set-up moves_
B2 r2 :_Set-up moves_
= [r2 B2: [l F2: [F2 l' : [U2, l U2 r'] ] (r) ] ]

The inner portion,
F2 l' :_Set-up moves_
(U2 l U2 r' U2 r U2 l') : _The commutator [U2, l U2 r']._
l F2 :_Set-up moves_
(r) : _The extra quarter turn

_is an "interior J-Perm". 
=
F2 l'
(U2 l U2 r' U2 r U2 l')
l F2
(r) 
=[F2 l' : [U2, l U2 r'] ] (r)
So, if we translate to the outer slices, lo and behold we have a *J-Perm*:
F2 L'
(U2 L U2 R' U2 R U2 L')
L F2
(R)

If we shift the following moves from the beginning to the end, we get a *T-Perm*.
L U2 R' U2 R U2 L'
L F2
R
F2 L' U2 :_The moves that were moved here from the beginning._

Note that this is equal to:
U2 L F2
F2 L'
(U2 L U2 R' U2 R U2 L')
L F2
(R)
F2 L' U2

*Summary:*
Basically we have the form:
B
A
(commutator)
A'
(quarter turn)
B'

Where we:
1) Started with a commutator
2) Applied set-up moves A to it to bring all pieces involved into the R slice
3) Applied a quarter turn to solve back exactly half of the pieces in slice R
_
Note that steps 1-3 make what I call a "base" algorithm._

4) Applied set-up moves B to Manipulate the remaining messed up pieces like we wish.

This algorithm form is what I call a symmetrical algorithm, because it has a lot of symmetry.

I have an entire thread about creating symmetrical parity algorithms for big cubes. You should check it out, as the idea is the same. I have not finished contributing to that thread yet, but what I have so far is definitely enough for people to get started on constructing common parity algorithms.

*Non-symmetrical algorithm*
Non-symmetrical algorithms can be composed of a base algorithm (like in symmetrical algorithms) + another algorithm piece. Non-symmetrical algorithms do not have symmetry. An example is a J-perm you may use as your primary algorithm:
R U2 R' U' R U2 L' U R' U' L

This algorithm can be written as:
R U set-up moves
(U R' U' R) commutator [U, R']
U' R' set-up moves
(R U' L' U R' U' L U) commutator [R, U' L' U]
(U') quarter turn

= [R U: [U, R'] ] [R, U' L' U] (U')


Clearly, to be able to construct this algorithm by hand, we:
1) Start out with the commutator U R' U' R
2) Add set-up moves R U (and invert them of course)
3) Add a corner commutator
4) Add the extra quarter turn to solve back half of the pieces.

We can also shift this algorithm to get a "*y-perm"*
R U2 L' U R' U' L
R U2 R' U'

Note that this is equal to
U R U2 R'
R U2 R' U' R U2 L' U R' U' L
R U2 R' U'


----------



## jerry (Jan 1, 2011)

This is awesome. I'll be messing around with this for a bit. I appreciate it man, thanks. :tu


----------



## Christopher Mowla (Jan 2, 2011)

No problem. I am glad I could help.

Note that it took ingenuity for me to decompose the non-symmetrical algorithm. So, if there is a non-symmetrical algorithm you wish to understand (at least its structure), you need to have the patience to write equivalences of it until you get familiar pieces. Remember, computer solvers don't tell you that they canceled a lot of moves: they just give you the final solution (with moves canceled). Transformations of algorithms may also be a good technique for simplifying the form of complex algorithms.

A good example of a computer-made non-symmetrical algorithm I decomposed was the optimal algorithm to swap two diagonal corners on a 4x4x4:
Rw2 f2 U2 Fw2 U' Rw2 U2 Fw2 U Fw2 R2 U2 F2 Rw2 U

After countless pages of work, I finally decomposed it to:
Rw2 F2 U2 r2   __________________________Preliminary
r2   ___________________________________ Extra turn to induce PLL Parity
U2 Fw2 U2 Fw2 U' Rw2 U2 Fw2 U Fw2 Rw2   ___Base 
r2 U2 F2 Rw2 __________________________Reverse of Preliminary
U   ____________________________________Finishing turn to make pure

Just as I hope we can learn from computer algorithms, I made my own algorithm to do the same thing. It was only one half turn move more, but the quarter turn move count was the same:
Rw2 F2 U2 y Rw2 U' Rw2 U D Lw2' U' Lw2' y' r2 U2 F2 Rw2 U

Its outline is:
Rw2 F2 U2 r2   ________________________Preliminary moves
r2   ____________  _____________________ Extra turn to induce PLL Parity 
y z' Uw2 L' Uw2 L R Uw2 R' Uw2 z y'   _______Base
r2 U2 F2 Rw2   _________________________Reverse of preliminary.
U   __________________________________Finishing turn to make pure

So, an important note is that non-symmetrical algorithms can also be a symmetrical algorithm which needs one or more additional turns to restore the cube. So watch out for those as well.


----------



## Christopher Mowla (Jan 5, 2011)

Lucas Garron asked me to find good explanations to the following four brief J-Perms if I could.

L' U R U' L U2 R' U R U2 R' 
R U R' F' R U R' U' R' F R2 U' R' U'
B2 R2 U' R2 U R2 D' R2 D B2 U'
F2 L' U' L F2 R' D R' D' R2

It is definitely relevant to this thread.


Algorithm #1:
(Non-symmetrical structure)
L' U R U' L U2 R' U R U2 R'= [R : [L', R' U R U'] [U2 R': [R U2: [R' , U] ] (U)] 

_A much easier derivation is in my next post._ _This approach is valid, but not so simple compared to the alternative!_
*Derivation*


Spoiler



1) Start with the commutator [R' , U].

[R' , U]

2) Add the set-up moves R U2 to bring all edges in the top layer (oriented).

R U2
[R' , U]
U2 R'

3) Add the quarter turn (U) to solve back two of the three edges currently out of place (and pull the one solved out). Now we have a 4-cycle of corners and a 2-cycle of edges.

R U2
[R',U]
U2 R'
(U)

4) Add the set-up moves U2 R' (or just shift the first two moves) to set-up for a corner commutator that we can cancel a lot of moves with. (unobvious, but...)

U2 R'
R U2
[R' , U]
U2 R'
(U)
R U2

5) Now we can add the corner commutator [L', R' U R U'] to have only two corners and two edges swapped (well, a center 90 degrees, but...)

U2 R'
R U2
[R' , U]
U2 R'
(U)
R U2
[L', R' U R U'] 

6) Shift the entire corner commutator backwards to have a different pair of corners affected for minimal set-up moves to finish off the algorithm.

[L', R' U R U']
U2 R'
R U2
[R' , U]
U2 R'
(U)
R U2

7) Add the set-up move R to complete the algorithm.

R
[L', R' U R U']
U2 R'
R U2
[R' , U]
U2 R'
(U)
R U2
R'

=
R
L' R' U R U' L U R' U' R
U2 R'
R U2
R' U R U'
U2 R'
(U)
R U2
R'

8) Cancel moves to achieve the algorithm.




Algorithm #2:
(Non-symmetrical structure)
R U R' F' R U R' U' R' F R2 U' R' U' = [U: (U') [R U R' : [F' , R U R' U' R'] [R, U] ]]

*Derivation*


Spoiler



1) Start with the commutator [U, R]

[U, R]

2) Add the corner commutator [R U R' U' R', F'] so that only three complete 1x2 blocks are affected. This is very much related to how the j-perm for the "standard edge flip algorithm" is made, except here we are using two commutators instead of one to cycle three 1x2 blocks.

[U, R]
[R U R' U' R', F']

3) Add the set-up moves R U R', one at a time to see how to move all 1x2 blocks into the top layer (oriented).

R U R'
[U, R]
[R U R' U' R', F']
R U' R'

4) Add a quarter turn, U
R U R'
[U, R]
[R U R' U' R', F']
R U' R'
(U)

5) Add the final set-up move, U to move the j-perm over in the top.


U
R U R'
[U, R]
[R U R' U' R', F']
R U' R'
(U)
U'

=
U
R U R'
U R U' R'
R U R' U' R' F' R U R U' R' F
R U' R'
(U)
U'

6) Cancel moves and take the inverse to achieve the algorithm.




Algorithm #3
(Symmetrical structure)

B2 R2 U' R2 U R2 D' R2 D B2 U' = [z': [B2: [U2 L' : [U2, L U2 R'] ] ] ] (U')

*Derivation*


Spoiler



1) Start with the commutator [U2, L U2 R'] to swap three 1x2 blocks.
_This is the same commutator used in the "standard edge flip parity algorithm"_

[U2, L U2 R']

2) Add the set-up moves U2 L' (do a backwards shift of two moves)

U2 L'
[U2, L U2 R']
L U2

3) Add a set-up move B2 to put the third block in slice L.

B2
U2 L'
[U2, L U2 R']
L U2
B2

4) Add a quarter turn, L'.

B2
U2 L'
[U2, L U2 R']
L U2
B2
(L')

5) We can rotate it into the top face
=
z'
B2
U2 L' U2 L U2 R' U2 R
B2
(L')
z

6) We can write an equivalent to omit the cube rotations. This produces the algorithm we wish to derive.




Algorithm #4:
(Symmetrical structure)
F2 L' U' L F2 R' D R' D' R2 = [F2 L' : (U)' [L F2 : [R2 : [R, D] ] ] ]


*Derivation*


Spoiler



1) Start with the commutator [D, R]

[D, R]

2) Add the set-up moves L F2 R2 to move all affected pieces to the top layer.

L F2 R2 
[D, R]
R2 F2 L'

3) Now we can add the quarter turn U to have only two edges and two corners swaped (and a center rotated 90 degrees)

L F2 R2 
[D, R]
R2 F2 L'
(U)

4) Add the set-up moves F2 L' to complete the algorithm (or just shift the first two moves)

F2 L'
L F2 R2 
[D, R]
R2 F2 L'
(U)
L F2

=
F2 L'
L F2 R2
D R D' R'
R2 F2 L'
(U)
L F2

5) Cancel moves and take the inverse to obtain the algorithm.


----------



## Lucas Garron (Jan 5, 2011)

cmowla said:


> Lucas Garron asked me to find good explanations to the following four brief J-Perms if I could.


Ooh, awesome. That was a lot faster than I expected.


----------



## Christopher Mowla (Jan 5, 2011)

After taking a break and looking at my equivalent to algorithm #1, I realized that I made it much more complicated than it should be. I think we can still learn something from my original explanation, but here is a very simple one:

Algorithm #1:
(Non-symmetrical structure)
L' U R U' L U2 R' U R U2 R' = [L', U R U'] (U) [R U :[R', U] ]
*
Derivation* #2


Spoiler



1) Start with the commutator [U, R']

[U, R']

2) Add set-up moves R U to bring all pieces into the top slice:

R U
[U, R']
U' R'

3) Add a quarter turn, U'.

R U 
U R' U' R
U' R'
(U')

4) Add the corner commutator [U R U', L'] to finish off the algorithm:

R U
U R' U' R
U' R'
(U')
[U R U', L'] 

=
R U
U R' U' R
U' R'
(U')
U R U' L' U R' U' L

5) Cancel moves and take the inverse to achieve the algorithm



I think the other derivations are easy enough to understand without much trouble. This is the one that needed a second approach.

EDIT:
So basically, all 4 algorithms start out with some commutator and eventually work to put all pieces into the same layer to do a quarter turn, and if more work is needed to finish off the rest of the algorithm, then so be it.

This is the exact same idea as many edge "flip" parity algorithms.


----------



## rachmaninovian (Jan 6, 2011)

*thread hijack*
hey cmowla, how many moves can you do a PLL parity + 2 dedge opp edge flip on the 4x4 (uh, to be clear, setup with PLL parity + MU 2 edge flip)?


----------



## Kenneth (Jan 6, 2011)

rachmaninovian said:


> *thread hijack*
> hey cmowla, how many moves can you do a PLL parity + 2 dedge opp edge flip on the 4x4 (uh, to be clear, setup with PLL parity + MU 2 edge flip)?


 
The 3-flip? lol, I was posting about it just recently in the FMC tread (in this subforum). Cmowla replied to there so he already did it


----------



## TMOY (Jan 6, 2011)

You mean swapping two dedges and flipping them at the same time ?
Then you can just setup it into a normal PLL parity, like LU'F (PLL parity) F'UL' (for UL and UR dedges) for example.


----------



## rachmaninovian (Jan 6, 2011)

TMOY said:


> You mean swapping two dedges and flipping them at the same time ?
> Then you can just setup it into a normal PLL parity, like LU'F (PLL parity) F'UL' (for UL and UR dedges) for example.


 
ah yes. thanks tmoy ^^


----------



## Kenneth (Jan 6, 2011)

rachmaninovian said:


> ah yes. thanks tmoy ^^


 
Aha, that case, there is also a commutator, that I prefer (I used to setup to PLL-parity until I found this):

r U2 l D2 l' U2 r' ... does half the job, mirror inverse it on the left for the rest : l U2 r D2 r' U2 l' (do last r' of first half and first l of second together as M)

Rw/Lw instead of r/l and you have OLL 55 + PLL-parity =)


----------



## Christopher Mowla (Jan 6, 2011)

rachmaninovian said:


> hey cmowla, how many moves can you do a PLL parity + 2 dedge opp edge flip on the 4x4 (uh, to be clear, setup with PLL parity + MU 2 edge flip)?





TMOY said:


> You mean swapping two dedges and flipping them at the same time ?



I don't know. I probably can't do better than cube explorer:

 r F2 U2 r' B2 l B2 r D2 l' E2 B2 l' y2 (13)

, which is equal to what we can already do using "LU'F (PLL parity) F'UL'", assuming that we use a PLL parity algorithm like r2 F2 U2 r2 U2 F2 r2, so that it can be applied to all size cubes. If not, for the 4x4x4, 12 may be the minimum.


----------



## riffz (Jan 7, 2011)

cmowla said:


> Lucas Garron asked me to find good explanations to the following four brief J-Perms if I could.
> 
> awesome stuff


 
Really interesting post.


----------



## Christopher Mowla (Jan 7, 2011)

riffz said:


> Really interesting post.


Thanks.


----------



## reThinking the Cube (Jan 7, 2011)

> Originally Posted by rachmaninovian
> hey cmowla, how many moves can you do a PLL parity + 2 dedge opp edge flip on the 4x4 (uh, to be clear, setup with PLL parity + MU 2 edge flip)?


 
Here are some more algs for your Case#4 at http://rachmaninovian.webs.com/step4b.htm

I don't know of any (without trying to take advantage of the unsolved centers) shorter than this 12 mover -

y (R U' B) [PLL] (B' U R') 

but

*(R U' R' U) F' [PLL] F (U' R U R')* 

is fast(er) for me, even though it is a few moves longer.

I also spotted a tweek for [x U M' U M' U2 M U M *U*] + [2R2 U2 2R2 u2 2R2 *u2*]

CubeX <Domino> generated 40 (not very useful) 12 movers for 4x4x4 ALWAYS requiring some awkward F/B turns. 3 examples -
R U2 R F2 R' U2 B2 L D2 L' B2 R' (12f*) //order 2 
R U2 R F2 L' B2 D2 L F2 R' B2 R' (12f*) //order 2
R U2 L D2 R' F2 U2 R D2 L' B2 R' (12f*) //order 2

At 13/14 Kenneth's - 2R U2 2L D2 2L' U2 (m) U2 2R D2 2R' U2 2L' (13) is probably the best of this type, but the alternating U2/D2 is somewhat undesirable.


----------



## Kenneth (Jan 7, 2011)

reThinking the Cube said:


> At 13/14 Kenneth's - 2R U2 2L D2 2L' U2 (m) U2 2R D2 2R' U2 2L' (13) is probably the best of this type, but the alternating U2/D2 is somewhat undesirable.



I'm used to do those D2's because I have them also in the opposite 3-cycles, that are the most common non parity cases if you leave 2 opposite dedges for last. Basicly the same as the 2-flip + PLL commutator, example : Lw' r' D2 r U2 r' D2 r U2 Lw

BTW, com to 2-flip (no parity) : r U2 (r' l') U2 r U2 r' U2 (l r) U2 r' U2


----------



## reThinking the Cube (Jan 7, 2011)

Kenneth said:


> BTW, com to 2-flip (no parity) : r U2 (r' l') U2 r U2 r' U2 (l r) U2 r' U2



and this - [Rw U2 Rw',R' U' R U]


----------



## Kenneth (Jan 7, 2011)

reThinking the Cube said:


> I don't know of any (even trying to take advantage of the unsolved centers) shorter than this 12 mover -



F2 r' F2 (r l) F2 l' F2

The 2x2x2 1+1 [wiki]PBL[/wiki] (but from that angle it makes a CLL)


----------



## rachmaninovian (Jan 7, 2011)

ah yes, thanks guys this has been interesting to me. thanks for all your help!


----------



## Christopher Mowla (Jan 7, 2011)

reThinking the Cube said:


> and this - [Rw U2 Rw',R' U' R U]


This reminds me of something.


Kenneth said:


> The 3-flip? lol, I was posting about it just recently in the FMC tread (in this subforum). Cmowla replied to there so he already did it


Kenneth, did you see my new "2-gen" 3-flipper and 5-flipper in the "A Collection of Algorithms" thread a few days ago?
Rw U2 Rw U2 Rw' U R U Rw U2 Rw' U' R' U' Rw R U R U Rw U2 Rw' U' R' U' Rw' U2 Rw' U2 Rw' (36 qtm, 30f)

Rw U2 Rw U' R U Rw U2 Rw' U' R' U' Rw U R U Rw U2 Rw' U' R' U' Rw' U R U Rw U2 Rw' U' R' U' Rw U R U Rw U2 Rw' U' R' U' R' U2 Rw' U2 Rw' (54 qtm, 47f)


----------



## Kenneth (Jan 8, 2011)

Lol, no, I missed those, 47f! I won't even try it on a cube


----------



## Christopher Mowla (Jun 15, 2011)

cmowla said:


> I don't know. I probably can't do better than cube explorer:
> 
> r F2 U2 r' B2 l B2 r D2 l' E2 B2 l' y2 (13)
> 
> , which is equal to what we can already do using "LU'F (PLL parity) F'UL'", assuming that we use a PLL parity algorithm like r2 F2 U2 r2 U2 F2 r2, so that it can be applied to all size cubes. If not, for the 4x4x4, 12 may be the minimum.


Sorry for the bump, but we were discussing the fewest moves for the case above, and I just found an interesting algorithm.

It's very horrible for speed, but it is 12 btm. It's actually pure too, and thus it can be applied to all big cube sizes, not just the 4x4x4. Hence the upper bound in btm for big cube sizes has just been lowered one btm. It appears to be optimal in quarter turns too. (E.G. L U' F r2 U2 r2 Uw2 r2 u2 F' U L' (18q, 12 btm) ).

F2 l E' F2 E l' r' E' F2 E r F2 (16q, 12 btm)
= [F2 r' E': [E r l E', F2]]


----------

