-2

I have to program a solver for a Rubik's cube 2x2x2, but i'm not getting it. I've already thought about some solutions, but not getting there

Can someone help me?

zepbarros
  • 1
  • 1
  • Possible duplicate of http://stackoverflow.com/questions/5563671/solving-rubiks-cube-programmatically?rq=1 – Brian Hoover Jul 07 '13 at 15:08
  • 3
    Can you share what you've tried or at least thought about? – lurker Jul 07 '13 at 18:18
  • The proposed duplicate seems to be about C programming, and judging by the tag, this is about Prolog. Languages as different as these lend themselves to somewhat different state representations and search tactics, though certainly insights from one can be borrowed for the other. – hardmath Jul 07 '13 at 20:03

2 Answers2

4

There is a full fledged example in SWI-Prolog distribution, with interactive GUI. It's a fairly complex sample, you will need to remove a large part of (relatively) non interesting stuff.

If you install SWI-Prolog in Windows, you can find it from menu:

Help / XPCE (GUI) Manual ... / File / Demo Programs ... / Rubiks Cube

CapelliC
  • 59,646
  • 5
  • 47
  • 90
3

Dennis Merritt has published a detailed account of the Rubik's cube puzzle in the PC AI magazine, and his account is available on the site of the Amzi! Prolog. He covers a 3x3x3 cube but the discussion of the data representation as well as the main structure of the solution should be applicable in your case as well.

Alexander Serebrenik
  • 3,567
  • 2
  • 16
  • 32