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

Method scramble

app/src/main/java/solver/Gear.java:86–109  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

84 }
85
86 public static String scramble() {
87 Random r = new Random();
88 int cp = r.nextInt(24);
89 int[] ep = new int[3];
90 for (int i = 0; i < 3; i++) {
91 do ep[i] = r.nextInt(24);
92 while (pd[i][24 * cp + ep[i]] < 0);
93 }
94 int eo = r.nextInt(27);
95 for (int d = 0; d < 7; d++) {
96 if (search(cp, ep[0], ep[1], ep[2], eo, d, -1)) {
97 if (d < 2) return scramble();
98 if (d < 3) {
99 continue;
100 }
101 StringBuilder sb = new StringBuilder();
102 for (int i = 1; i <= d; i++) {
103 sb.append(turn[seq[i] / 11]).append(suff[seq[i] % 11]).append(" ");
104 }
105 return sb.toString();
106 }
107 }
108 return "error";
109 }
110}

Callers 1

generateScrambleMethod · 0.95

Calls 2

searchMethod · 0.95
toStringMethod · 0.80

Tested by

no test coverage detected