0

I want to do some basic rotations on a scrambled Rubik cube in prolog untill it's solved. I am thinking of saving the cube as lists like so:

[w,w,w,w,w,w,w,w,w],
[b,b,b,b,b,b,b,b,b],
[g,g,g,g,g,g,g,g,g],
[r,r,r,r,r,r,r,r,r],
[o,o,o,o,o,o,o,o,o],
[y,y,y,y,y,y,y,y,y] ...but scrambled

How can I implement rotations(R,U,F,B,D,L) , so that when I do a U rotation, my cube will look something like this:

 [w,w,w,w,w,w,w,w,w],
 [r,r,r,b,b,b,b,b,b],
 [o,o,o,g,g,g,g,g,g],
 [g,g,g,r,r,r,r,r,r],
 [b,b,b,o,o,o,o,o,o],
 [y,y,y,y,y,y,y,y,y]    ???

So I want to write some rotations in console and the program to return true if cube is solved or false if isn't.

If someone has some ideas I would be greatful to see them :)

unt mazga
  • 41
  • 1
  • 5

0 Answers0