This might help you with the visualization of the issue...
Rubiks Cube Screen Saver - The Toids World
The problem with each face being a 3 x 3 x 3 is you don't actually have 27 elements... you have 9.
Where the logic of this would drive me batty is working out the agacency issues... As you say, rotating one face is actually pretty easy, but rotating one row of each adjacent face ... onto another face ... now that's some true digital legerdemain.
Although... I shold warn you, I'm probably not the right person to talk to about Rubik's Cube...
Back when they first came out a friend gave me one, nicely pre-scrambled, for my birthday. Well, I'm a sucker for a good puzzle and ended up spending most of my holiday from work on it, took it to work after, kept twisting away on it, almost all of my spare them, for upwards of 3 months before I solved it... And even then I figure I did it by accident, not skill. So I went down to a local hobby shop and got a trophy base for it, finished it all up real nice in black walnut. Drilled a hole and tapped a spike through the base, glued the cube so it would never move again, heated up the spike and melted one corner of the the cube onto the spike, so it looked like a proper trophy. Then I got out the engraving tools and wrote a suggestion that my friend should perform a sexual impossibility on the little brass plaque... and gave it back to him for Christmas. To this day, he still won't give me birthday gifts...
Ahahah, funny story
About the 9 elements, which ones would you suggest? the [6][3][3] array you talked about earlier?
The problem here would probably be the rotation. Whilst with the [3][3][3] array, I think it's easier to rotate (not sure).
I really appreciate all this discussion. It's getting very interesting, and I noticed that some people might think the same. I'll be glad to post my full solution once I made it. Thank you.
It's not necessarily easier to rotate the 3x3x3 "piece-based" representation since you also have to calculate new orientations for the pieces, whereas with the 6x3x3 "square-based" representation, although the basic rotation is more complicated, the orientation problem goes away. Also, the square-based rep. works well with bare ints, but the other requires a struct with type, orientation, colors....
Yep... treat it as a hollow cube. In the multiple piece method you have an additional complexity in that some of your small cubes have 1 side showing, some have 2 and some have 3... but none of them have all 6 so it's just a lot easier to envision as 6 flat surfaces...
Just give each colour a number... and let the rotation wrangling begin...
Last edited by CommonTater; 12-30-2011 at 07:25 PM.
If it were me then I'd start with the 3x3x3 voxel with a colour for each voxel's face. At least this way I know exactly how to rotate it already.
Hey CommonTater, if only you had a lot of programming experience back then. You could have written a program to tell you exactly what moves are required to solve it. .
I read on newscientist that every initial starting point is solvable in twenty moves. Edit: found it, here's the link: 'God couldn't do faster': Rubik's cube mystery solved - physics-math - 11 August 2010 - New Scientist
Ya know I'm almost tempted to write a rubik solver myself now, a bit like how I wrote a sudoku solver some time ago. Hmm, we could make it into a competition.
Last edited by iMalc; 12-30-2011 at 07:35 PM.
My homepage
Advice: Take only as directed - If symptoms persist, please see your debugger
Linus Torvalds: "But it clearly is the only right way. The fact that everybody else does it some other way only means that they are wrong"
I think, not sure, that you could consider the center square fixed in color and just rotate the edges around it.
I can not see any easy way to represent the data.
But, I think I would try 6 faces; I just not what I would use as the face structure/type.
Edit: Decided that a simple one dim array would be my first try if I tried to solve this problem. I think 0-19 would hold all the pieces locations. 8 top, 8 bottom and 4 sides. (I consider the center positions to never change)
The logic would not be simple to write; but, I think it would be easier that an 2 or 3 dim array solution.
Tim S.
Last edited by stahta01; 12-30-2011 at 08:05 PM.