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

Method randomTEG

app/src/main/java/solver/Cube222.java:327–391  ·  view source on GitHub ↗
(int type, int twist)

Source from the content-addressed store, hash-verified

325 }
326
327 public static void randomTEG(int type, int twist) {
328 reset();
329 //整体转动
330 //for (int i = 0; i < 3; i++)
331 doMove(6, r.nextInt(4));
332 //交换底层2块
333 //doMove(3, r.nextInt(4));
334 switch (type) {
335 case 4: //不交换
336 break;
337 case 2: //交换相邻两块
338 swap(4, 6);
339 break;
340 case 1: //交换相对两块
341 swap(5, 6);
342 break;
343 case 6: //不交换或交换相邻块
344 if (r.nextInt(2) == 1)
345 swap(4, 5);
346 break;
347 case 5: //不交换或交换相对块
348 if (r.nextInt(2) == 1)
349 swap(5, 6);
350 break;
351 case 3: //交换任意两块
352 swap(4+r.nextInt(2), 6);
353 break;
354 default:
355 switch (r.nextInt(3)) {
356 case 0:
357 break;
358 case 1:
359 swap(4, 6);
360 break;
361 case 2:
362 swap(5, 6);
363 break;
364 }
365 break;
366 }
367 //随机顶层
368 for (int i = 0; i < 4; i++) {
369 swap(i, i + r.nextInt(4 - i));
370 }
371 Utils.idxToOri(state[1], r.nextInt(27), 4, true);
372 //一个底角翻转
373 twist(4, twist);
374 //随机一个顶角翻转
375 twist(r.nextInt(4), 3 - twist);
376 doMove(0, r.nextInt(4));
377 //将DBL块放到D层
378 while (state[0][4] != 7 && state[0][5] != 7 && state[0][6] != 7
379 && state[0][7] != 7) {
380 doMove(7, 1);
381 }
382 //将DBL块放回原位
383 while (state[0][7] != 7) {
384 doMove(6, 1);

Callers 3

scrambleTCLLMethod · 0.95
scrambleTEG1Method · 0.95
scrambleTEG2Method · 0.95

Calls 5

resetMethod · 0.95
doMoveMethod · 0.95
swapMethod · 0.95
idxToOriMethod · 0.95
twistMethod · 0.95

Tested by

no test coverage detected