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

Method scrambleL2L

app/src/main/java/solver/Skewb.java:158–179  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

156 }
157
158 public static String scrambleL2L() {
159 int[] arr = new int[6], arr2 = new int[4];
160 Utils.idxToPerm(arr, r.nextInt(60), 5, true);
161 arr[5] = 5;
162 int ct = Utils.permToIdx(arr, 6, true);
163 int cp = 0, co;
164 do {
165 //cp = r.nextInt(12);
166 Utils.idxToOri(arr2, r.nextInt(27), 4, true);
167 arr = new int[] {arr2[0], arr2[1], 0, 0, arr2[2], 0, 0, arr2[3]};
168 co = Utils.oriToIdx(arr, 8, true);
169 } while (cd[co * 12 + cp] < 0);
170 for (int d = 0; d < 12; d++)
171 if (search(ct, cp, co, d, -1)) {
172 if (d < 2) return scramble();
173 if (d < 5) {
174 continue;
175 }
176 return move2fcn(d);
177 }
178 return "error";
179 }
180
181 static String move2fcn(int d) {
182 String[] move2str = { "R", "U", "L", "B" };

Callers 1

generateScrambleMethod · 0.95

Calls 7

idxToPermMethod · 0.95
permToIdxMethod · 0.95
idxToOriMethod · 0.95
oriToIdxMethod · 0.95
searchMethod · 0.95
scrambleMethod · 0.95
move2fcnMethod · 0.95

Tested by

no test coverage detected