MCPcopy Create free account
hub / github.com/MeigenChou/DCTimer-Android / initt

Method initt

app/src/main/java/solver/Sq1Shape.java:157–193  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

155
156 private static boolean init = false;
157 static void initt() {
158 if (init) return;
159 for (int i = 0; i < 3678; i++) {
160 prunTws[i] = -1;
161 }
162 prunTws[1170] = prunTws[1192] = prunTws[2640] = prunTws[2662] = 0;
163 int tol = 4;
164 //twist
165 for (int d = 0; d < 7; d++) {
166 //int count = 0;
167 for (int i = 0; i < 3678; i++)
168 if (prunTws[i] == d) {
169 int next = twist(shapeIdx[i]);
170 if (prunTws[getShape2Idx(next)] == -1) {
171 prunTws[getShape2Idx(next)] = (byte) (d + 1);
172 tol++;
173 //count++;
174 for (int a = 0; a < 13; a++) {
175 for (int b = 0; b < 13; b++) {
176 if (canTwist(next)) {
177 int temp = getShape2Idx(next);
178 if (prunTws[temp] == -1) {
179 prunTws[temp] = (byte) (d + 1);
180 tol++;
181 }
182 }
183 next = rotateBottom(next);
184 }
185 next = rotateTop(next);
186 }
187 }
188 }
189 //Log.w("sq", d+1+"\t"+tol);
190 //System.out.println(d+1+" "+count);
191 }
192 init = true;
193 }
194
195 private static boolean searchTws(int shape, int d, int lm) {
196 if (d == 0) return shape == solved; //prunTws[getShape2Idx(shape)] == 0;

Callers 1

solveTwsMethod · 0.95

Calls 5

twistMethod · 0.95
getShape2IdxMethod · 0.95
canTwistMethod · 0.95
rotateBottomMethod · 0.95
rotateTopMethod · 0.95

Tested by

no test coverage detected