MCPcopy Index your code
hub / github.com/MeigenChou/DCTimer-Android / init

Method init

app/src/main/java/solver/PyraminxV.java:16–71  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

14 private static boolean ini;
15
16 private static void init() {
17 if (ini) return;
18 for (int a = 0; a < 15; a++) {
19 for (int b = 0; b < 4; b++) {
20 for (int f = 0; f < 4; f++) {
21 int c = getmv(a, b, b, f);
22 eom[4 * a + b][f] = (short) ((c / 8) << 2 | (c & 3));
23 if (b < 2)
24 epm[2 * a + b][f] = (short) (c >> 2);
25 }
26 }
27 }
28 int[] tws = new int[3];
29 for (int p = 0; p < 27; p++)
30 for (int m = 0; m < 4; m++) {
31 Utils.idxToOri(tws, p, 3, false);
32 switch (m) {
33 case 0: //L
34 tws[1]++; if (tws[1] == 3) tws[1] = 0;
35 break;
36 case 1: //R
37 tws[2]++; if (tws[2] == 3) tws[2] = 0;
38 break;
39 case 2: //B
40 tws[0]++; if (tws[0] == 3) tws[0] = 0;
41 break;
42 }
43 com[p][m] = (short) Utils.oriToIdx(tws, 3, false);
44 }
45 Arrays.fill(prun, (byte)-1);
46 prun[3 * 8] = prun[4 * 8] = prun[0] = 0;
47 int c = 3;
48 for (int d = 0; d < 6; d++) {
49 //int p = 0;
50 for (int i = 0; i < 27; i++)
51 for (int j = 0; j < 30; j++)
52 for (int k = 0; k < 4; k++)
53 if (prun[i * 120 + j * 4 + k] == d)
54 for (int m = 0; m < 4; m++) {
55 int x = i, y = j, z = k;
56 for (int n = 0; n < 2; n++) {
57 x = com[x][m];
58 z = eom[y / 2 * 4 + z % 4][m] % 4;
59 y = epm[y][m];
60 int next = x * 120 + y * 4 + z;
61 if (prun[next] < 0) {
62 prun[next] = (byte) (d + 1);
63 //p++;
64 c++;
65 }
66 }
67 }
68 //Log.w("dct", d+1+"\t"+c);
69 }
70 ini = true;
71 }
72
73 private static int getmv(int c, int p, int o, int f) {

Callers 1

solveVMethod · 0.95

Calls 3

getmvMethod · 0.95
idxToOriMethod · 0.95
oriToIdxMethod · 0.95

Tested by

no test coverage detected