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

Method petrus1

app/src/main/java/solver/Petrus.java:161–187  ·  view source on GitHub ↗
(String scramble, int block, boolean solveS2)

Source from the content-addressed store, hash-verified

159 "UDFBRL", "UDLRFB", "UDRLBF", "UDBFLR"};
160 private static String[] blks = {"ULF:", "ULB:", "URF:", "URB:", "DLF:", "DLB:", "DRF:", "DRB:"};
161 private static String petrus1(String scramble, int block, boolean solveS2) {
162 String[] s = scramble.split(" ");
163 int co = 12, ep = 102, eo = 136;
164 for (int d = 0; d < s.length; d++)
165 if (0 != s[d].length()) {
166 int o = moveIdx[block].indexOf(s[d].charAt(0));
167 co = com[co][o]; ep = epm[ep][o]; eo = eom[eo][o];
168 if (s[d].length() > 1) {
169 co = com[co][o]; eo = eom[eo][o]; ep = epm[ep][o];
170 if (s[d].charAt(1) == '\'') {
171 co = com[co][o]; eo = eom[eo][o]; ep = epm[ep][o];
172 }
173 }
174 }
175 for (int d = 0; d < 9; d++) {
176 //Log.w("dct", "d "+d);
177 if (idaPetrus1(co, ep, eo, d, -1, block)) {
178 StringBuilder sb = new StringBuilder("\n");
179 sb.append(blks[block]);
180 for (int i = d; i > 0; i--)
181 sb.append(' ').append(moveIdx[block].charAt(seq[i] / 3)).append(suff[seq[i] % 3]);
182 if (solveS2) sb.append(petrus2(s, block, d));
183 return sb.toString();
184 }
185 }
186 return "\nerror";
187 }
188
189 static String petrus2(String[] s, int block, int d) {
190 int[] co2 = new int[3], ep2 = new int[3], eo2 = new int[3];

Callers 1

solvePetrusMethod · 0.95

Calls 5

idaPetrus1Method · 0.95
petrus2Method · 0.95
lengthMethod · 0.80
indexOfMethod · 0.80
toStringMethod · 0.80

Tested by

no test coverage detected