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

Method idaPetrus2

app/src/main/java/solver/Petrus.java:139–156  ·  view source on GitHub ↗
(int co, int ep, int eo, int depth, int lm, int idx)

Source from the content-addressed store, hash-verified

137
138 private static int[] solvedEp = {88, 42, 34}, solvedEo = {176, 84, 68}, solvedCo = {0, 15, 21};
139 private static boolean idaPetrus2(int co, int ep, int eo, int depth, int lm, int idx) {
140 if (depth == 0) return ep == solvedEp[idx] && eo == solvedEo[idx] && co == solvedCo[idx];
141 if (ed2[ep << 2 | eo & 3] > depth) return false;
142 for (int i = 0; i < 3; i++)
143 if (i != lm) {
144 int x = co, y = ep, s = eo;
145 for (int j = 0; j < 3; j++) {
146 x = com[x][moves2[i]];
147 y = epm2[y][moves2[i]];
148 s = eom2[s][moves2[i]];
149 if (idaPetrus2(x, y, s, depth - 1, i, idx)) {
150 seq[depth] = moves2[i] * 3 + j;
151 return true;
152 }
153 }
154 }
155 return false;
156 }
157
158 private static String[] moveIdx = {"DULRBF", "FBLRDU", "DUFBLR", "DURLFB",
159 "UDFBRL", "UDLRFB", "UDRLBF", "UDBFLR"};

Callers 1

petrus2Method · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected