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

Method xcross

app/src/main/java/solver/Cross.java:365–405  ·  view source on GitHub ↗
(String scramble, int face)

Source from the content-addressed store, hash-verified

363 }
364
365 private static String xcross(String scramble, int face) {
366 String[] s = scramble.split(" ");
367 int[] co = new int[4], feo = new int[4];
368 for (int i = 0; i < 4; i++) {
369 co[i] = (i + 4) * 3;
370 feo[i] = i * 2;
371 }
372 int ep = 1656, eo = 1104;
373 for (int d = 0; d < s.length; d++)
374 if (s[d].length() != 0) {
375 int m = moveStr[0][face].indexOf(s[d].charAt(0));
376 for (int i = 0; i < 4; i++) {
377 co[i] = fcm[co[i]][m];
378 feo[i] = fem[feo[i]][m];
379 }
380 ep = epm[ep][m]; eo = eom[eo][m];
381 if (s[d].length() > 1) {
382 for (int i = 0; i < 4; i++) {
383 co[i] = fcm[co[i]][m];
384 feo[i] = fem[feo[i]][m];
385 }
386 eo = eom[eo][m]; ep = epm[ep][m];
387 if (s[d].charAt(1) == '\'') {
388 for (int i = 0; i < 4; i++) {
389 co[i] = fcm[co[i]][m];
390 feo[i] = fem[feo[i]][m];
391 }
392 eo = eom[eo][m]; ep = epm[ep][m];
393 }
394 }
395 }
396 for (int d = 0; d < 11; d++)
397 for (int slot = 0; slot < 4; slot++)
398 if (idaxcross(ep, eo, co[slot], feo[slot], slot, d, -1)) {
399 StringBuilder sb = new StringBuilder(rotateStr[0][face]);
400 for (int i = d; i > 0; i--)
401 sb.append(' ').append(moveStr[0][0].charAt(seq[i] / 3)).append(suff[seq[i] % 3]);
402 return sb.toString();
403 }
404 return "error";
405 }
406
407 public static String solveXcross(String scramble, int face) {
408 init();

Callers 1

solveXcrossMethod · 0.95

Calls 4

idaxcrossMethod · 0.95
lengthMethod · 0.80
indexOfMethod · 0.80
toStringMethod · 0.80

Tested by

no test coverage detected