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

Method searchTws

app/src/main/java/solver/Sq1Shape.java:195–220  ·  view source on GitHub ↗
(int shape, int d, int lm)

Source from the content-addressed store, hash-verified

193 }
194
195 private static boolean searchTws(int shape, int d, int lm) {
196 if (d == 0) return shape == solved; //prunTws[getShape2Idx(shape)] == 0;
197 if (prunTws[getShape2Idx(shape)] > d) return false;
198 //top move
199 for (int i = 0; i < 12; i++) {
200 if (i != 0) sol[sollen++] = i;
201 //bottom move
202 for (int j = 0; j < 12; j++) {
203 if (j != 0) sol[sollen++] = -j;
204 //twist
205 if ((lm != 0 || (i != 0 || j != 0)) && canTwist(shape)) {
206 int next = twist(shape);
207 sol[sollen++] = 0;
208 if (searchTws(next, d-1, 0)) {
209 return true;
210 }
211 sollen--;
212 }
213 if (j != 0) sollen--;
214 shape = rotateBottom(shape);
215 }
216 if (i != 0) sollen--;
217 shape = rotateTop(shape);
218 }
219 return false;
220 }
221
222 private static String move2string() {
223 StringBuilder sb = new StringBuilder("\n\nttm: ");

Callers 1

solveTwsMethod · 0.95

Calls 5

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

Tested by

no test coverage detected