org.kociemba.twophase
Class Search

java.lang.Object
  extended by org.kociemba.twophase.Search

public class Search
extends java.lang.Object

Class Search implements the Two-Phase-Algorithm.


Constructor Summary
Search()
           
 
Method Summary
static java.lang.String solution(java.lang.String facelets, int maxDepth, long timeOut, boolean useSeparator)
          Computes the solver string for a given cube.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Search

public Search()
Method Detail

solution

public static java.lang.String solution(java.lang.String facelets,
                                        int maxDepth,
                                        long timeOut,
                                        boolean useSeparator)
Computes the solver string for a given cube.

Parameters:
facelets - is the cube definition string, see Facelet for the format.
maxDepth - defines the maximal allowed maneuver length. For random cubes, a maxDepth of 21 usually will return a solution in less than 0.5 seconds. With a maxDepth of 20 it takes a few seconds on average to find a solution, but it may take much longer for specific cubes.
timeOut - defines the maximum computing time of the method in seconds. If it does not return with a solution, it returns with an error code.
useSeparator - determines if a " . " separates the phase1 and phase2 parts of the solver string like in F' R B R L2 F . U2 U D for example.
Returns:
The solution string or an error code:
Error 1: There is not exactly one facelet of each colour
Error 2: Not all 12 edges exist exactly once
Error 3: Flip error: One edge has to be flipped
Error 4: Not all corners exist exactly once
Error 5: Twist error: One corner has to be twisted
Error 6: Parity error: Two corners or two edges have to be exchanged
Error 7: No solution exists for the given maxDepth
Error 8: Timeout, no solution within given time