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

Method move2string

app/src/main/java/cs/sq12phase/Search.java:313–348  ·  view source on GitHub ↗
(int len)

Source from the content-addressed store, hash-verified

311 }
312
313 private String move2string(int len) {
314 //TODO whether to invert the solution or not should be set by params.
315 StringBuilder s = new StringBuilder();
316 int[] outputMoves = new int[len];
317 if ((verbose & INVERSE_SOLUTION) != 0) {
318 for (int i = len - 1; i >= 0; i--) {
319 outputMoves[len - 1 - i] = move[i] > 0 ? (12 - move[i]) : move[i] < 0 ? (-12 - move[i]) : move[i];
320 }
321 } else {
322 for (int i = 0; i < len; i++) {
323 outputMoves[i] = move[i];
324 }
325 }
326
327 int top = 0, bottom = 0;
328 for (int i = 0; i < len; i++) {
329 int val = outputMoves[i];
330 if (val > 0) {
331 top = (val > 6) ? (val - 12) : val;
332 } else if (val < 0) {
333 bottom = (-val > 6) ? (-val - 12) : -val;
334 } else {
335 if (top == 0 && bottom == 0) {
336 s.append(" / ");
337 } else {
338 s.append('(').append(top).append(",").append(bottom).append(") / ");
339 }
340 top = 0;
341 bottom = 0;
342 }
343 }
344 if (top != 0 || bottom != 0) {
345 s.append('(').append(top).append(",").append(bottom).append(")");
346 }
347 return s.toString();// + " (" + len + "t)";
348 }
349
350 private boolean phase2(int edge, int corner, boolean topEdgeFirst, boolean botEdgeFirst, int ml, int maxl, int depth, int lm) {
351 if (maxl == 0 && !topEdgeFirst && botEdgeFirst/*edge==0 && corner==0 && !topEdgeFirst && botEdgeFirst && ml==0*/) {

Callers 2

isSolvedInPhase1Method · 0.95
init2Method · 0.95

Calls 1

toStringMethod · 0.80

Tested by

no test coverage detected