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

Class EOline

app/src/main/java/solver/EOline.java:6–124  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4import static solver.Utils.turn;
5
6public class EOline {
7 private static short[][] eom = new short[2048][6];
8 private static short[][] epm = new short[132][6];
9 private static byte[] eod = new byte[2048];
10 private static byte[] epd = new byte[132];
11 private static int[] seq = new int[10];
12
13 static {
14 int[] arr = new int[12];
15 for (int i = 0; i < 2048; i++) {
16 for (int j = 0; j < 6; j++) {
17 Utils.idxToFlip(arr, i, 12, true);
18 Cross.edgemv(arr, j);
19 eom[i][j] = (short) Utils.flipToIdx(arr, 12, true);
20 }
21 }
22 for (int i = 0; i < 66; i++)
23 for (int j = 0; j < 2; j++)
24 for (int k = 0; k < 6; k++)
25 epm[i * 2 + j][k] = (short) getEpm(i, j, k);
26 for (int i = 1; i < 2048; i++) eod[i] = -1;
27 eod[0] = 0;
28 Utils.createPrun(eod, 7, eom, 3);
29 for (int i = 0; i < 132; i++) epd[i] = -1;
30 epd[106] = 0;
31 Utils.createPrun(epd, 4, epm, 3);
32 }
33
34 private static int getEpm(int eci, int epi, int k) {
35 int[] combination = new int[12];
36 Utils.idxToComb(combination, eci, 2, 12);
37 int[] permutation = new int[2];
38 Utils.idxToPerm(permutation, epi, 2, false);
39 byte[] selectedEdges = {8, 10};
40 int next = 0;
41 int[] ep = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 };
42 for (int i = 0; i < 12; i++)
43 if (combination[i] != 0) ep[i] = selectedEdges[permutation[next++]];
44 switch (k) {
45 case 0: Utils.circle(ep, 4, 7, 6, 5); break;
46 case 1: Utils.circle(ep, 8, 9, 10, 11); break;
47 case 2: Utils.circle(ep, 7, 3, 11, 2); break;
48 case 3: Utils.circle(ep, 5, 1, 9, 0); break;
49 case 4: Utils.circle(ep, 6, 2, 10, 1); break;
50 case 5: Utils.circle(ep, 4, 0, 8, 3); break;
51 }
52 byte[] edgesMapping = {0, 1, 2, 3};
53 int[] ec = new int[12];
54 for (int i = 0; i < 12; i++)
55 ec[i] = ep[i] > 0 ? 1 : 0;
56 eci = Utils.combToIdx(ec, 2, 12);
57 int[] edgesPermutation = new int[2];
58 next = 0;
59 for (int i = 0; i < 12; i++)
60 if (ec[i] != 0) edgesPermutation[next++] = ep[i] > -1 ? edgesMapping[ep[i] - 8] : -1;
61 epi = Utils.permToIdx(edgesPermutation, 2, false);
62 return eci * 2 + epi;
63 }

Callers

nothing calls this directly

Calls 5

idxToFlipMethod · 0.95
edgemvMethod · 0.95
flipToIdxMethod · 0.95
getEpmMethod · 0.95
createPrunMethod · 0.95

Tested by

no test coverage detected