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

Method roux1

app/src/main/java/solver/Roux.java:296–337  ·  view source on GitHub ↗
(String scramble, int side, boolean solveS2)

Source from the content-addressed store, hash-verified

294 private static int[][] oriIdx = {{1, 0, 2, 3}, {0, 1, 3, 2}, {2, 3, 0, 1}, {3, 2, 1, 0}};
295
296 private static String roux1(String scramble, int side, boolean solveS2) {
297 String[] s = scramble.split(" ");
298 int[] cp = new int[4], co = new int[4], ep = new int[4], eo = new int[4];
299 for (int i = 0; i < 4; i++) {
300 cp[i] = scp[oriIdx[side % 2][i]];
301 co[i] = sco[oriIdx[side % 2][i]];
302 ep[i] = sep[oriIdx[side % 2][i]];
303 eo[i] = seo[oriIdx[side % 2][i]];
304 }
305 for (int d = 0; d < s.length; d++)
306 if (s[d].length() > 0) {
307 for (int i = 0; i < 4; i++) {
308 int m = moveIdx[side / 2][i].indexOf(s[d].charAt(0));
309 cp[i] = cpm[cp[i]][m]; co[i] = com[co[i]][m];
310 ep[i] = Petrus.epm[ep[i]][m]; eo[i] = Petrus.eom[eo[i]][m];
311 if (s[d].length() > 1) {
312 cp[i] = cpm[cp[i]][m]; co[i] = com[co[i]][m];
313 ep[i] = Petrus.epm[ep[i]][m]; eo[i] = Petrus.eom[eo[i]][m];
314 if (s[d].charAt(1) == '\'') {
315 cp[i] = cpm[cp[i]][m]; co[i] = com[co[i]][m];
316 ep[i] = Petrus.epm[ep[i]][m]; eo[i] = Petrus.eom[eo[i]][m];
317 }
318 }
319 }
320 }
321 for (int d = 0; d < 10; d++) {
322 for (int idx = 0; idx < 4; idx++)
323 if (idaRoux1(cp[idx], co[idx], ep[idx], eo[idx], d, -1)) {
324 StringBuilder sb = new StringBuilder("\n");
325 sb.append(sideStr[side]).append(": ").append(rotateIdx[side / 2]).append(rotateIdx2[idx]);
326 for (int i = d; i > 0; i--)
327 sb.append(' ').append(turn[seq[i] / 3]).append(suff[seq[i] % 3]);
328 if (solveS2) {
329 int[] s1 = Arrays.copyOf(seq, d + 1);
330 s1[0] = (side / 2) * 4 + idx;
331 sb.append(roux2(scramble, s1));
332 }
333 return sb.toString();
334 }
335 }
336 return "\nerror";
337 }
338
339 private static void getEdge(int[] n, int c, int p, int o) {
340 int[] s = new int[3];

Callers 1

solveRoux1Method · 0.95

Calls 5

idaRoux1Method · 0.95
roux2Method · 0.95
lengthMethod · 0.80
indexOfMethod · 0.80
toStringMethod · 0.80

Tested by

no test coverage detected