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

Method scramblePBL

app/src/main/java/cs/sq12phase/Search.java:90–111  ·  view source on GitHub ↗
(Random r)

Source from the content-addressed store, hash-verified

88 }
89
90 public String scramblePBL(Random r) {
91 String scr;
92 do {
93 int[] corner = {7, 6, 5, 4, 3, 2, 1, 0};
94 //Log.w("dct", "corner "+Util.get8Perm(corner));
95 for (int i = 0; i < 4; i++) {
96 int x = i + r.nextInt(4 - i);
97 if (x != i) Utils.swap(corner, i, x);
98 x = i + 4 + r.nextInt(4 - i);
99 if (x != i + 4) Utils.swap(corner, i + 4, x);
100 }
101 int[] edge = {7, 6, 5, 4, 3, 2, 1, 0};
102 for (int i = 0; i < 4; i++) {
103 int x = i + r.nextInt(4 - i);
104 if (x != i) Utils.swap(edge, i, x);
105 x = i + 4 + r.nextInt(4 - i);
106 if (x != i + 4) Utils.swap(edge, i + 4, x);
107 }
108 scr = solution(FullCube.randomCube(1037, Utils.get8Perm(corner, 8), Utils.get8Perm(edge, 8)), INVERSE_SOLUTION);
109 } while (scr.length() < 4);
110 return scr;
111 }
112
113 public String scrambleWCA() {
114 String sol;

Callers

nothing calls this directly

Calls 5

swapMethod · 0.95
solutionMethod · 0.95
randomCubeMethod · 0.95
get8PermMethod · 0.95
lengthMethod · 0.80

Tested by

no test coverage detected