()
| 103 | |
| 104 | private static boolean inif = false; |
| 105 | static void initf() { |
| 106 | if (inif) return; |
| 107 | for (int i = 0; i < 3678; i++) { |
| 108 | prunTrn[i] = -1; |
| 109 | } |
| 110 | prunTrn[getShape2Idx(solved)] = 0; |
| 111 | int tol = 1; |
| 112 | for (int d = 0; d < 14; d++) { |
| 113 | for (int i = 0; i < 3678; i++) { |
| 114 | if (prunTrn[i] == d) { |
| 115 | int state = shapeIdx[i]; |
| 116 | // twist |
| 117 | if (canTwist(state)) { |
| 118 | int next = twist(state); |
| 119 | int temp=getShape2Idx(next); |
| 120 | if (prunTrn[temp] == -1) { |
| 121 | prunTrn[temp] = (byte) (d + 1); |
| 122 | tol++; |
| 123 | } |
| 124 | } |
| 125 | // rotate top |
| 126 | int nextTop = shapeIdx[i]; |
| 127 | for (int j = 0; j < 11; j++) { |
| 128 | nextTop = rotateTop(nextTop); |
| 129 | if (canTwist(nextTop)) { |
| 130 | int temp=getShape2Idx(nextTop); |
| 131 | if (prunTrn[temp] == -1) { |
| 132 | prunTrn[temp] = (byte) (d + 1); |
| 133 | tol++; |
| 134 | } |
| 135 | } |
| 136 | } |
| 137 | // rotate bottom |
| 138 | int nextBottom = shapeIdx[i]; |
| 139 | for (int j = 0; j < 11; j++) { |
| 140 | nextBottom = rotateBottom(nextBottom); |
| 141 | if (canTwist(nextBottom)) { |
| 142 | int temp=getShape2Idx(nextBottom); |
| 143 | if (prunTrn[temp] == -1) { |
| 144 | prunTrn[temp] = (byte) (d + 1); |
| 145 | tol++; |
| 146 | } |
| 147 | } |
| 148 | } |
| 149 | } |
| 150 | } |
| 151 | //Log.w("sq", d+1+"\t"+tol); |
| 152 | } |
| 153 | inif = true; |
| 154 | } |
| 155 | |
| 156 | private static boolean init = false; |
| 157 | static void initt() { |
no test coverage detected