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

Method solve

app/src/main/java/solver/PyraminxV.java:138–169  ·  view source on GitHub ↗
(String scramble, int face)

Source from the content-addressed store, hash-verified

136
137 private static int[] solvedEp = {0, 6, 8};
138 private static String solve(String scramble, int face) {
139 String[] s = scramble.split(" ");
140 int t = 0;
141 int[] p = {0, 6, 8}, f = {0, 12, 16};
142 for (int i = 0; i < s.length; i++)
143 if (s[i].length() > 0) {
144 int o = moveStr[face].indexOf(s[i].charAt(0));
145 if (o < 0) continue;
146 t = com[t][o];
147 for (int j=0; j<3; j++) {
148 p[j] = epm[p[j]][o];
149 f[j] = eom[f[j]][o];
150 }
151 if (s[i].length() > 1) {
152 t = com[t][o];
153 for (int j=0; j<3; j++) {
154 p[j] = epm[p[j]][o];
155 f[j] = eom[f[j]][o];
156 }
157 }
158 }
159 for (int d = 0; d < 7; d++) {
160 for (int idx = 0; idx < 3; idx++)
161 if (search(p[idx], f[idx], t, solvedEp[idx], d, -1)) {
162 StringBuilder sb = new StringBuilder();
163 for (int i = d; i > 0; i--)
164 sb.append(' ').append(moveStr[face].charAt(seq[i] / 2)).append(suff[seq[i] % 2]);
165 return sb.toString();
166 }
167 }
168 return " error";
169 }
170
171 public static String solveV(String scramble, int face) {
172 init();

Callers 1

solveVMethod · 0.95

Calls 4

searchMethod · 0.95
lengthMethod · 0.80
indexOfMethod · 0.80
toStringMethod · 0.80

Tested by

no test coverage detected