| 7 | import solver.Utils; |
| 8 | |
| 9 | public class Search { |
| 10 | public static final int INVERSE_SOLUTION = 0x2; |
| 11 | static final int FACE_TURN_METRIC = 0; |
| 12 | static final int WCA_TURN_METRIC = 1; |
| 13 | private static final int PRUN_INC = 2; |
| 14 | |
| 15 | private int[] move = new int[100]; |
| 16 | private FullCube c = null; |
| 17 | private FullCube d = new FullCube(""); |
| 18 | private Square sq = new Square(); |
| 19 | private int length1; |
| 20 | int movelen1; |
| 21 | private int maxlen2; |
| 22 | int verbose; |
| 23 | private String sol_string; |
| 24 | |
| 25 | static { |
| 26 | Shape.init(); |
| 27 | Square.init(); |
| 28 | // try { |
| 29 | // InputStream in = new BufferedInputStream(new FileInputStream(APP.dataPath + "sq1.dat")); |
| 30 | // read(Shape.ShapeIdx, in); |
| 31 | // in.read(Shape.ShapePrun); |
| 32 | // in.read(Shape.ShapePrunOpt); |
| 33 | // read(Shape.spTopMove, in); |
| 34 | // read(Shape.spBottomMove, in); |
| 35 | // read(Shape.spTwistMove, in); |
| 36 | // read(Square.sqTwistMove, in); |
| 37 | // read(Square.sqTopMove, in); |
| 38 | // read(Square.sqBottomMove, in); |
| 39 | // in.read(Square.SquarePrun); |
| 40 | // in.close(); |
| 41 | // } catch (Exception e) { |
| 42 | // |
| 43 | // try { |
| 44 | // OutputStream out = new BufferedOutputStream(new FileOutputStream(APP.dataPath + "sq1.dat")); |
| 45 | // write(Shape.ShapeIdx, out); |
| 46 | // out.write(Shape.ShapePrun); |
| 47 | // out.write(Shape.ShapePrunOpt); |
| 48 | // write(Shape.spTopMove, out); |
| 49 | // write(Shape.spBottomMove, out); |
| 50 | // write(Shape.spTwistMove, out); |
| 51 | // write(Square.sqTwistMove, out); |
| 52 | // write(Square.sqTopMove, out); |
| 53 | // write(Square.sqBottomMove, out); |
| 54 | // out.write(Square.SquarePrun); |
| 55 | // out.close(); |
| 56 | // } catch (Exception e1) { e.printStackTrace(); } |
| 57 | // } |
| 58 | } |
| 59 | |
| 60 | private String solution(FullCube c, int verbose) { |
| 61 | this.c = c; |
| 62 | this.verbose = verbose; |
| 63 | sol_string = null; |
| 64 | int shape = c.getShapeIdx(); |
| 65 | for (length1 = Shape.ShapePrun[shape]; length1 < 50; length1++) { |
| 66 | maxlen2 = Math.min(33 - length1, 17); |