This question already has an answer here:
- Cycling with Rubik's 9 answers
On a Rubik's Cube, performing a particular sequence of moves repeatedly will always return it to its original state. Your job is to figure out the "order" of a particular sequence of moves, that is, the number of times it must be repeated before the original state is restored.
There have been other questions about this in the past:
But most of the answers are trivial solutions which simply perform the algorithm on a simulated cube repeatedly and count the repetitions needed to restore it to its original state.
But this question is different because I'm specifically disallowing such trivial solutions. Performing the turns repeatedly on a simulated cube and counting the repetitions that were needed to reach the original state is not allowed. There should be no loop nor recursive call in your program that runs the same or a greater number of times as the order or the sequence unless its purpose is somehow strictly related to golfing and not a functionally necessary part of the calculation of the order itself.
Edit: if you have trouble understanding what “no trivial solutions” or “don’t repeatedly execute the sequence on a simulated cube, and return the number of repetitions that were required to restore it to its original state” means, then you can follow this additional criterion to help: if you choose to execute the sequence on a simulated cube, you may do so no more than 4 times.
The moves are defined in Singmaster Notation. The linked questions explain this quiet well. You're not required to support double moves formatted as "F2", "U2" ect. as input, "FF" and "UU" are acceptable, but the former are also allowed.
Example output (taken from other question):
Move Order (empty) 1 F 4 FF 2 FFFF 1 U'L' 105 LLUU 6 L'L'U' 30 RUUD'BD' 1260 U'L'U'LU'L'U'U'L 4 R'LFRL'U' 5
Move Order (empty) 1 F 4 F2 2 F2F2 1 U'L' 105 L2U2 6 L2 U' 30 RU2D'BD' 1260 U'L'U'LU'L'U2L 4 R'LFRL'U' 5
This is code golf. The winning answer will be the one with the smallest code.