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

Method scramble

app/src/main/java/solver/RouxMU.java:100–123  ·  view source on GitHub ↗
(Random r)

Source from the content-addressed store, hash-verified

98 }
99
100 public static String scramble(Random r) {
101 int ep, ct, cp;
102 int[] p = new int[6];
103 do {
104 ep = r.nextInt(720);
105 ct = r.nextInt(4);
106 cp = r.nextInt(4);
107 Utils.idxToPerm(p, ep, 6, false);
108 } while (Utils.permutationSign(p) != ctcpSign(ct, cp));
109 int eo = r.nextInt(32);
110 for (int d = 0; d < 21; d++) {
111 if (search(ep, eo, ct, cp, d, -1)) {
112 if (d < 2) return scramble(r);
113 if (d < 4) {
114 continue;
115 }
116 StringBuilder sb = new StringBuilder();
117 for (int i = 1; i <= d; i++)
118 sb.append(turn[seq[i] / 3]).append(suffInv[seq[i] % 3]).append(" ");
119 return sb.toString();
120 }
121 }
122 return "error";
123 }
124}

Callers 1

generateScrambleMethod · 0.95

Calls 5

idxToPermMethod · 0.95
permutationSignMethod · 0.95
ctcpSignMethod · 0.95
searchMethod · 0.95
toStringMethod · 0.80

Tested by

no test coverage detected