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 SkipVought 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
0
0
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
 
First thought:

Just concentrated on the red-white-green corner, it takes N moves to come so you have to do 3N moves to have it back in the original rotation. Then surely something else will still be out of whack and adds another factor to the formula.

Regarding N: There are 6 stations on the way of it's original position back to it. But it's not moved in every move. It's moved in the 1st, 2nd, 4th, 6th, 7th and 9th move and not in the 10th. But I'd count that too, because afterwards that pattern repeats. So it's 30xM, Figure out M.

Bye, Olaf.
 
Well, on the bright side the solution is a multiple of 30, so I think that you are on the right track [thumbsup2]

-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
 
Maybe I'm off because I was trying to track the movement of one square on a piece of paper. But it the bottom right had to move 15 times to return to its original position. What I didn't count was how many times a turn was made and it didn't move. :p
 
I must not understand your instructions because when I follow them manually my cube returns to its original position in 6 moves.


mmerlinn

"Political correctness is the BADGE of a COWARD!"

 
Now if I had a cube, it's hard to do moves just in the mind. We need to concentrate on other single elements and find out how many moves it takes to put them in their original position and rotation. Then find out the least common multiple.

Bye, Olaf.
 
mmerlin, I think you spin the green and white face, while you should spin the orange (bottom) face of the cube.

It takes the white-green edge 14 moves to come back.

14=2*7
30=2*3*5

least common multiple is 2*3*5*7=210

I wonder if any other period for a certain other corner or edge would include a higher prime number like 11. But even 7 is rather odd, so could be the case.

Assuming you would not have taken your time for 2*3*5*7*11=4620 moves or even higher (if there is a period of n*13 etc.), it should be 210 moves.

But that's no proof, just taking probabilities into account and making assumptions on your patience.

Bye, Olaf.
 
sorry, 2*3*5*7 is of course 2310, half of 4620. Still a low probability, that you would have had the patience for 2310 moves...

Bye, Olaf.
 
Again,

hmm, could also be something like 2*2*3*7 or 2*3*3*7, the least common multiple. A prime number can be a factor twice or more. So could also be 420 or 630. Hmm.

Bye, Olaf.
 
mmerlinn, I'll try the best with my makeshift ascii drawing - but here's what I'm trying to explain:

Code:
                 yellow (in back and hidden)
        -------------
       /    red     /|
      /            / |
     |------------|  |
     |         [COLOR=white green] | [/color]| green
blue |   white [COLOR=white green] | [/color]|  /
     |[COLOR=white orange]  <---   [/color][COLOR=white green] V [/color]| /
     --------------/

         orange
Start by turning the green face down (towards you) From a solved position, the first move would make the white face look like this:
Code:
   |   |[COLOR=red red]   [/color]
-----------
   |   |[COLOR=red red]   [/color]
-----------
   |   |[COLOR=red red]   [/color]
Then the 2nd move would be to spin the orange face, which is on the bottom, to the left. After doing that, the white face of the cube would look like this:

Code:
   |   |[COLOR=red red]   [/color]
-----------
   |   |[COLOR=red red]   [/color]
-----------
[COLOR=green green]   [/color]|[COLOR=green green]   [/color]|[COLOR=green green]   [/color]
Then, continue to alternate those 2 moves until the cube becomes solved again. It will take much more than 6 moves.

-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
 
Olaf, what is the reasoning behind the least common multiples? Your answer is correct, but I'm not sure why. Could you explain?

-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
 
The reasoning behing least common multiples? Well, looking at each piece on it's own, you have a certan period of moves, after which it restores position and orientation.

All pieces will be in their initial position and orientation when all these independant periods end together. And that is surely the case, if you multiply all the periods, but the least common multiple is sufficient.

It's comparable to several gearwheels with a certain amount of cogs. If you take one with 6 cogs and one with 15, you need need to spin the 6-cog-gearwheel 5 times to move the 15-cog-gearwheel twice and be in the initial position. Or you need to spin the 15 gear-wheel twice to have the 6-cog-gearwheel in its original position. Because then both gearwheels have moved 30 cogs, which is the least common multiple of 6 and 15.

Bye, Olaf.
 
The middle pieces of the green and orange faces don't move, but they rotate. But as you spin each face 105 times 90 degrees, that finally rotates them 90 degrees. So if you not only care about the colors but also the rotation, then you would need 4*210=840 moves to put the cube back to it's initial state including rotation of the middle pieces.

Bye, Olaf.
 
But, is there a way to figure the number of turns without manually counting them (or number crunching with a script) to identify the number of turns.

Am I correct in saying:
We must end on an even number of rotations.
We're only dealing with 15 cogs.
7 rotate on green
7 rotate on orange
1 shared

Maybe it's just making the numbers fit Olaf's post, but it'd provide primes 2, 3, 5, & 7.

If we add another rotation, say on blue, would it take 154 (2 * 7 * 11) moves? Or do I have it wrong and it's really 322 (2 * 7 * 23) moves? Or, am I entirely incorrect because my numbers are made up? ;)
 
My numbers (made up though they may be) are off if we add another rotation. I think there'd be a * 3 in there.

even = 2
22 cogs = 11 * 2
7 blue = 7
7 green = 7
6 orange = 3 * 2
1 orange/blue = 1
1 orange/green = 1

2 * 3 * 7 * 11 = 462.
 
Skie,

I think you are getting my gearwheel analogon a little wrong.

There are 15 elements of the cube moving if you count the middle ones. I'd say 3 shared plus 6 other elements on both faces, but okay. You got that right.

So the analogon to the problem would be 15 gearwheels, not 15 cogs. Each gearwheel will have as much cogs, as you need moves to put the corresponding element back to initial position and rotation.

But there's a cathc: As I said in the first example of the red-white-green I counted 10 to put the corner back (rotated though), although it's back after 9 moves already. The thing is, after 18 moves it will not be back. The (partly) period is not done, because the first move of the first period moved that corner, the 10th move would not, so it belongs to that period. And you need to do that 3 times to get the rotation right, which results in 30 moves.

My results so far are:
red-white-green: 30 = 2*3*5
white-green: 14 = 2*7
middle orange: 8 = 2*2*2
middle green: 8 = 2*2*2

That alone makes 4 of the 15 gearwheels. It gives a least common multiple of 840, due to the rotation of the middle elements, for which you don't really need to care. Without them it's 210 so far.

It would matter if any other element would contribute more prime factors to the overall result. For a proof I need to provide those periods too. I only argued on the fact, kaht has done this by trying. And he might have given up after more moves. I didn't proove it yet.

more periods:
white-green-orange: 6 moves - we alreasdy have 2*3, no new factor.

blue-white-orange: 30 moves - again what we already have.

All in all that corner takes the same root as the red-white-green corner, only starts/ends at a different position. The same goes for all other corners, except the white-green-orange. But no new prime factors from 6 too.

And if I think about it, all edges take the same route too. Then it's 210 or 840 respectively, depending on taking the middle elements into account or not.

Bye, Olaf.
 
Thanks for the explanation Olaf, I see where I went wrong. When only green is rotated, there's a gear with 4 cogs. Adding the secondary rotation on orange creates a new gear for each unique path a cube takes.
 
Credit goes to Olaf for figuring this out. Here's my explanation based on his findings:

6 corner blocks are affected by the turns
of these positions, a block will spend two turns in each of 4 positions, and one turn in each of 2 positions.

Thus, it takes 10 turns (2*4 + 1*2) for a corner block to make a full rotation.

However, to return to its original orientation, it must complete 3 rotations.

Thus, period for corner blocks = 30.

7 side blocks are affected
of these positions, a block will spend two turns in each of 6 positions, and one turn in the remaining position, but will visit it twice in a rotation.

Thus, it takes 14 turns (2*6 + 2*1*1) to make a full rotation. A rotation does not change a side block's orientation.

Thus, period for side blocks = 14.

If we count the orientation of the middle blocks (which I think is a nice twist), there are two blocks affected, but neither changes position. Thus, each block makes a rotation every 2 turns. It takes 4 rotations to return to its original orientation.

Thus, period for middle blocks is 8.

The least common denominator of 30, 14, and 8 is 840.

Ignoring the middle blocks, lcd of 30 and 14 is 210.

This is a fun mathematical exercise. Thanks for the distraction.


Thus, it takes
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top