🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Rubik's Cube algorithm

Started by
7 comments, last by quasaR 23 years ago
Hello !! Could someone point me to, give some link or share with me code that could solve Rubik''s Cube? Anything will do...(: Thanx
Advertisement
Thanx for the hint, this might be quite a challenge for me to do :p

But as for your question: I am not aware of any such algorithm at the moment, sorry... Perhaps I''ll have my own anytime soon
Just search around for ''Cube of Rubik''. When i was writting such an applet, i had come across plenty of links regarding algorythms of solving the cube.

c ''ya around
... LEMMINGS ... LEMMINGS ... LEMMINGS ... LEM..... SpLaSh!...Could this be what we stand like before the mighty One?Are we LeMmIngS or WhAt!? ;)
There is a great shareware/freeware program out there which allows you to enter the state of your cube and will solve it usually within <20 moves regardless of the state it is in. Very nice. I believe it uses IDA* along with some look up tables for heuristics. It''s not guaranteed to give you the shortest solutions, but it is very good. There''s also a peer reviewed paper out there which used a similar scheme to solve in the shortest possible number of moves.

I don''t have the references available right now as my computer is stuck in a warehouse while I relocate. But I originally found it using Ask.com by searching for Rubik''s Cube. If your interested I can post the exact reference when I get my computer back ~June 1st. I''ll look around and get back if I find it.

-Kirk

Theoretically, rubik''s cube can be solved within 21 moves from any position. All you need to do is set up a recursive function with that as a limit.
The problem with simply setting 21 as a maximal depth limit and searching exhaustively until a solution is found is that from any particular cube configuration, you have available to you 27 unique possible moves - 3 layers with 3 degrees of turn in 3 dimensions. Searching exhaustively to a depth of 21 moves would require 27^21 nodes in your search tree.

The paper in which the cube was solved for the fewest moves used IDA* with lookup tables for heuristics - I think I said that above. Sorry for the repeat.

Once I have my stuff back, I''ll post the references for the paper and the program which solves for you.

-Kirk
Thanks for pointing that out, I didn''t think of that. Bear in mind though, rotation of a middle layer is not normally considered a move; there are only 18 possible moves at any point.
Thanks very much for your answers. The idea with recursive functions would be fine but our comps are to slow for this (; .I searched Ask.com and i think i found some logical ideas of how to solve RCube. Now i''m trying to convert it to C++.
Once again thanx
c''ya
Sorry for the lengthy delay in getting back in here. Just got my computer out of storage. ugh.

Anyways, the program I spoke of previously is called Cube Explorer. You can search Excite for "cube explorer" and hit the web site. Or, here''s the link:

http://home.t-online.de/home/kociemba/cube.htm

I''m sure it used IDA* with lookup tables. My experience has been that any level of scrambled cube can be solved by this program in typically less than 20 moves. Sometimes more, but not often. Best I''ve seen so far is a cube a sat with for about an hour and turned it somewhere around 500 times randomly.
The solution ended up being 13 moves. ugh.

-Kirk

This topic is closed to new replies.

Advertisement