Search code examples
calgorithmrubiks-cube

Solving Rubik's cube programmatically


I am trying to develop a program for solving a Rubik's cube in C. I used back tracking technique for this. It is a very long process and it takes lot of iterations, so I'm not able to solve it.

Please give me suggestions on how to solve this more efficiently - such as other techniques or adopting backtracking itself. In Google I found a lot of shortcuts for solving this but I don't want to solve this by using shortcuts.


Solution

  • Why not use a human oriented solution and program this.

    You need some pattern matching, but it won't be that hard. (Besides there are programs solving the 1000x1000x1000).

    The basic idea is to work in phases:

    • First layer
    • Second layer
    • Third layer

    For each layer you implement a couple of algorithms that turn pattern X into pattern X'. Each step in a phase should bring the cube close to solving. You can do this by adding a value to each pattern (where higher values are given to more unsolved cubes). You can also add a difficulty (for example the number of turns) so you can select an algorithm based on the best value gain per difficulty (or reach the best result with the least turns).

    The fun of this approach, is that you can add new algorithms if you like and test how often they are used. So you can test the usefulness of each algorithm.

    If you really want to earn those geekpoints, create a separate language to describe the algorithms and the pattern they are solving.