| 91 | } |
| 92 | |
| 93 | private static int getmv(int c, int k, int po, int f) { |
| 94 | int[] n = new int[7], s = new int[4], o = new int[4]; |
| 95 | Utils.idxToPerm(s, po, k, false); |
| 96 | Utils.idxToOri(o, po, k, false); |
| 97 | int q = k, t; |
| 98 | for (t = 0; t < 7; t++) |
| 99 | if (c >= Utils.Cnk[6 - t][q]) { |
| 100 | c -= Utils.Cnk[6 - t][q--]; |
| 101 | n[t] = s[q] << 3 | o[k - 1 - q]; |
| 102 | } |
| 103 | else n[t] = -3; |
| 104 | switch (f) { |
| 105 | case 0: //U |
| 106 | Utils.circle(n, 0, 1, 3, 2); break; |
| 107 | case 1: //R |
| 108 | Utils.circle(n, 0, 4, 5, 1, new int[] {2, 1, 2, 1}); |
| 109 | break; |
| 110 | case 2: //F |
| 111 | Utils.circle(n, 0, 2, 6, 4, new int[] {1, 2, 1, 2}); |
| 112 | break; |
| 113 | } |
| 114 | c = po = 0; q = k; |
| 115 | for (t = 0; t < 7; t++) |
| 116 | if (n[t] >= 0) { |
| 117 | c += Utils.Cnk[6 - t][q--]; |
| 118 | s[q] = n[t] >> 3; |
| 119 | po += (n[t] & 7) % 3; |
| 120 | po *= 3; |
| 121 | } |
| 122 | int i = Utils.permToIdx(s, k, false); |
| 123 | return Utils.fact[k] * c + i << 7 | po / 3; |
| 124 | } |
| 125 | |
| 126 | private static boolean search3(int scp, int sco, int cp, int co, int d, int lm) { |
| 127 | if (d == 0) return cp == scp && co == sco; |