-2

I need a Rubiks cube generator for my project. I searched a lot but I only found websites that provide me a scramble but do not provided a method/function to do so. Is there a way for me to make my own or is an algorithm already available. Thanks

braX
  • 11,506
  • 5
  • 20
  • 33
mrf1freak
  • 71
  • 2
  • 8
  • 2
    If you were given a physical Rubik's Cube, would you have to search websites for instructions on how to scramble it? If not, then don't you already have one solution to your problem? – Paul Hankin Apr 22 '17 at 22:12
  • take a look at this: [Quaternion rotation do not works as excepted](http://stackoverflow.com/a/39024016/2521214) you will find there C++ code for my rubi cube slice rotations so just first init your cube to solved state and then randomly turn random slices ... – Spektre Apr 23 '17 at 07:25
  • @PaulHankin so I just make an array like [R, L, R', L', F, F'] etc and just pick a random rotation from it? I thought about it but it just didnt seem right. – mrf1freak Apr 23 '17 at 07:45

1 Answers1

1
  1. Find yourself a way how to represent the cube (each side and each cell of a side)
  2. Determine, how your representation changes when rotating a horizontal section once clockwise and how your representation changes when rotating a vertical section once clockwise.
  3. n times, randomly select a horizontal or vertical section and rotate it once clockwise.
Ridcully
  • 23,362
  • 7
  • 71
  • 86