| 7 | import static solver.Utils.suffInv; |
| 8 | |
| 9 | public class Cube222 { |
| 10 | private static int[][] state = new int[2][8]; |
| 11 | private static byte[] perm = new byte[5040]; |
| 12 | private static byte[] twst = new byte[729]; |
| 13 | private static short[][] permmv = new short[5040][3]; |
| 14 | private static short[][] twstmv = new short[729][3]; |
| 15 | |
| 16 | private static String[] turn = {"U", "R", "F"}; |
| 17 | private static byte[][] cFacelet = { |
| 18 | { 3, 4, 9 }, { 1, 20, 5 }, { 2, 8, 17 }, { 0, 16, 21 }, |
| 19 | { 13, 11, 6 }, { 15, 7, 22 }, { 12, 19, 10 }, { 14, 23, 18 } |
| 20 | }; |
| 21 | //private static int[] seq = new int[12]; |
| 22 | private static Random r = new Random(); |
| 23 | |
| 24 | static { |
| 25 | calcperm(); |
| 26 | } |
| 27 | |
| 28 | private static void permMove(int[] ps, int m) { |
| 29 | switch (m) { |
| 30 | case 0: //U |
| 31 | Utils.circle(ps, 0, 1, 3, 2); break; |
| 32 | case 1: //R |
| 33 | Utils.circle(ps, 0, 4, 5, 1); break; |
| 34 | case 2: //F |
| 35 | Utils.circle(ps, 0, 2, 6, 4); break; |
| 36 | case 3: //D |
| 37 | Utils.circle(ps, 4, 6, 7, 5); break; |
| 38 | case 4: //L |
| 39 | Utils.circle(ps, 2, 3, 7, 6); break; |
| 40 | case 5: //B |
| 41 | Utils.circle(ps, 1, 5, 7, 3); break; |
| 42 | } |
| 43 | } |
| 44 | |
| 45 | private static void twistMove(int[] ps, int m) { |
| 46 | int c; |
| 47 | switch (m) { |
| 48 | case 0: |
| 49 | Utils.circle(ps, 0, 1, 3, 2); //U |
| 50 | break; |
| 51 | case 1: |
| 52 | Utils.circle(ps, 0, 4, 5, 1, new int[] {2, 1, 2, 1}); //R |
| 53 | //c = ps[0]; ps[0] = ps[4] + 2; ps[4] = ps[5] + 1; ps[5] = ps[1] + 2; ps[1] = c + 1; |
| 54 | break; |
| 55 | case 2: |
| 56 | Utils.circle(ps, 0, 2, 6, 4, new int[] {1, 2, 1, 2}); //F |
| 57 | //c = ps[0]; ps[0] = ps[2] + 1; ps[2] = ps[6] + 2; ps[6] = ps[4] + 1; ps[4] = c + 2; //F |
| 58 | break; |
| 59 | case 3: |
| 60 | Utils.circle(ps, 4, 6, 7, 5); //D |
| 61 | break; |
| 62 | case 4: |
| 63 | Utils.circle(ps, 2, 3, 7, 6, new int[] {1, 2, 1, 2}); //L |
| 64 | //c = ps[2]; ps[2] = ps[3] + 1; ps[3] = ps[7] + 2; ps[7] = ps[6] + 1; ps[6] = c + 2; //L |
| 65 | break; |
| 66 | case 5: |