Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Rubik's

Status
Not open for further replies.

kaht

Programmer
Aug 18, 2003
4,156
US
I know a Rubik's cube is a puzzle in and of itself, but my question involves only a small part of a Rubik's cube.

Imagine you are holding a Rubik's cube and you are looking at the white face of the cube. If the cube is oriented such that the green face is on the right side, that will put the orange face on the bottom.
Code:
                 yellow (in back and hidden)
        -------------
       /    red     /|
      /            / |
     |------------|  |
     |            | green
blue |    white   |  /
     |            | /
     --------------/

         orange

Now, assuming the cube is starting out solved and alternating between only 2 moves - spinning the green face down (toward you) and the orange face to the left, how many moves will it take to scramble and then resolve the cube? I just manually did it, so I know the answer, but this is the hard part - how can it be solved programmatically w/o using a loop and checking for a solved state after each move? After doing it manually it took this many moves to solve:
210

So, alternating between the 2 moves:
[ol][li]Spin right side face (green) down toward you[/li]
[li]Spin bottom side face (orange) to the left[/li]
[li]GOTO 1[/li][/ol]

How long does it take for the cube to resolve itself, and why?

-kaht

Lisa, if you don't like your job you don't strike. You just go in every day and do it really half-assed. That's the American way. - Homer Simpson
 
Nah, I learned how to solve one a few years back, but that's a pretty neat machine [smile]

-kaht

Lisa, if you don't like your job you don't strike. You just go in every day and do it really half-assed. That's the American way. - Homer Simpson
 
From being a tad of a "cubist" myself, I know of some variations. I have three Rubik's cubes on my desk at work: a 3x3x3, a 4x4x4, and a 5x5x5. :)

• Rotate the rightt face 90 degrees clockwise about its face. Rotate the entire cube so that the top face does not change and the rear face becomes the right face. Repeat process. How many iterations of this before the cube is solved?

• Rotate the right face 90 degrees clockwise about its face and the leftmost face 90 degrees clockwise about its face. Rotate the entire cube so that the top face does not change and the rear face becomes the right face. Repeat. How many iterations to solve? If you start again but only perform half the number of iterations, you will find a neat zig-zag pattern on the sides of the cube with the top and bottom solved. If you then perform the same half-tranformation again only starting with the "wrong" pair of faces, you will find another interesting transformation, again with the top and bottom faces solved.

[COLOR=black #d0d0d0]My alarm clock causes time travel. When I hit snooze, no apparent time passes before the alarm sounds again, but the universe has in fact moved forward through time by ten minutes![/color]
 
I have a Rubik's cube with pictures in place of the colors. It makes an interesting twist as you get it solved only to realize the center square is not oriented correctly with the rest of the picture and have to start all over.


[thumbsup2] Wow, I'm having amnesia and deja vu at the same time.
I think I've forgotten this before.


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top