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

Method init

app/src/main/java/cs/sq12phase/Shape.java:151–193  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

149 }
150
151 public static void init() {
152 if (inited) {
153 return;
154 }
155 int count = 0;
156 for (int i = 0; i < 13 * 13 * 13 * 13; i++) {
157 int dr = halflayer[i % 13];
158 int dl = halflayer[i / 13 % 13];
159 int ur = halflayer[i / 13 / 13 % 13];
160 int ul = halflayer[i / 13 / 13 / 13];
161 int value = ul << 18 | ur << 12 | dl << 6 | dr;
162 if (Integer.bitCount(value) == 16) {
163 ShapeIdx[count++] = value;
164 }
165 }
166 Shape s = new Shape();
167 for (int i = 0; i < 3678 * 2; i++) {
168 s.setIdx(i);
169 spTopMove[i] = s.topMove();
170 spTopMove[i] |= s.getIdx() << 4;
171 s.setIdx(i);
172 spBottomMove[i] = s.bottomMove();
173 spBottomMove[i] |= s.getIdx() << 4;
174 s.setIdx(i);
175 s.twistMove();
176 spTwistMove[i] = (char) s.getIdx();
177 }
178
179 for (int i = 0; i < 3678 * 2; i++) {
180 ShapePrun[i] = -1;
181 ShapePrunOpt[i] = -1;
182 }
183 ShapePrun[getShape2Idx(0x0db66db)] = 0; //0 110110110110 011011011011
184 ShapePrun[getShape2Idx(0x1db6db6)] = 0; //1 110110110110 110110110110
185 ShapePrun[getShape2Idx(0x16db6db)] = 0; //1 011011011011 011011011011
186 ShapePrun[getShape2Idx(0x06dbdb6)] = 0; //0 011011011011 110110110110
187 //Log.w("dct", "init shape...");
188 initPruning(ShapePrun, 4, Search.FACE_TURN_METRIC);
189 ShapePrunOpt[new FullCube().getShapeIdx()] = 0;
190 //Log.w("dct", "init shapeopt...");
191 initPruning(ShapePrunOpt, 1, Search.WCA_TURN_METRIC);
192 inited = true;
193 }
194}
195

Callers 1

SearchClass · 0.95

Calls 8

setIdxMethod · 0.95
topMoveMethod · 0.95
getIdxMethod · 0.95
bottomMoveMethod · 0.95
twistMoveMethod · 0.95
getShape2IdxMethod · 0.95
initPruningMethod · 0.95
getShapeIdxMethod · 0.80

Tested by

no test coverage detected