# How can I generate algorithms equivalent to a given algorithm?



## NFSergiu (Nov 12, 2016)

I am developing a computer program that solves the Rubik's cube. It is not anything advanced nor fast. It solves the cube by the Friedrich method, using algorithms that I use in real life to solve the cube. Because of that, the output solving algorithm is quite a long one and I was wondering is there is a way to transform the output to an equivalent algorithm, but shorter. This might actually be impossible, but I think this is a question worth asking. For example here is a list of equivalent algorithms that orient the corners of the last layer of that cube state shown in the image.


----------



## Jaysammey777 (Nov 12, 2016)

You can generate them using cube explorer, if that works for what you are trying to do.


----------



## xyzzy (Nov 13, 2016)

Depends on what your goal is. If all you want is a short solution, don't use CFOP; implement the Thistlethwaite/Kociemba algorithm instead.

If you want a short solution that still "looks" like CFOP, you can try full colour neutrality and all 24 orders of inserting the F2L pairs, then pick the combination that leads to the shortest overall solution (including the move count for the last layer). You can sometimes force a skip for either OLL or PLL this way, which saves you 10-ish moves.

If you want to just optimise the solution you've already generated without modifying it too much (whatever that means), pull out a 15-move substring from the middle of it and replace that with an optimal solution (write an optimal solver yourself or use Cube Explorer), and repeat this for all 15-move substrings of your solution. I've not tried this before, but you can probably save a few moves this way.


----------

