Revision e1dc3366
Added by Leszek Koltunski about 3 years ago
src/main/java/org/distorted/objects/TwistyBandagedAbstract.java | ||
---|---|---|
154 | 154 |
private int mCurrState; |
155 | 155 |
private int mIndexExcluded; |
156 | 156 |
ScrambleState[] mStates; |
157 |
private int[][] mScrambleTable; |
|
158 |
private int[] mNumOccurences; |
|
157 | 159 |
|
158 | 160 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
159 | 161 |
|
... | ... | |
447 | 449 |
return getNumLayers(); |
448 | 450 |
} |
449 | 451 |
|
452 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
453 |
|
|
454 |
private void initializeScrambling() |
|
455 |
{ |
|
456 |
int numLayers = getNumLayers(); |
|
457 |
|
|
458 |
if( mScrambleTable ==null ) |
|
459 |
{ |
|
460 |
mScrambleTable = new int[NUM_AXIS][numLayers]; |
|
461 |
} |
|
462 |
if( mNumOccurences ==null ) |
|
463 |
{ |
|
464 |
int max=0; |
|
465 |
|
|
466 |
for (ScrambleState mState : mStates) |
|
467 |
{ |
|
468 |
int tmp = mState.getTotal(-1); |
|
469 |
if (max < tmp) max = tmp; |
|
470 |
} |
|
471 |
|
|
472 |
mNumOccurences = new int[max]; |
|
473 |
} |
|
474 |
|
|
475 |
for(int i=0; i<NUM_AXIS; i++) |
|
476 |
for(int j=0; j<numLayers; j++) mScrambleTable[i][j] = 0; |
|
477 |
} |
|
478 |
|
|
450 | 479 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
451 | 480 |
// PUBLIC API |
452 | 481 |
|
... | ... | |
456 | 485 |
{ |
457 | 486 |
mCurrState = 0; |
458 | 487 |
mIndexExcluded =-1; |
488 |
initializeScrambling(); |
|
459 | 489 |
} |
460 | 490 |
|
461 |
int total = mStates[mCurrState].getTotal(mIndexExcluded); |
|
462 |
int random= rnd.nextInt(total); |
|
463 |
int[] info= mStates[mCurrState].getInfo(random,mIndexExcluded); |
|
491 |
int[] info= mStates[mCurrState].getRandom(rnd, mIndexExcluded, mScrambleTable, mNumOccurences); |
|
464 | 492 |
|
465 | 493 |
scramble[curr][0] = info[0]; |
466 | 494 |
scramble[curr][1] = info[1]; |
src/main/java/org/distorted/objects/TwistyCube.java | ||
---|---|---|
132 | 132 |
private int mCurrState; |
133 | 133 |
private int mIndexExcluded; |
134 | 134 |
private final ScrambleState[] mStates; |
135 |
private int[][] mScrambleTable; |
|
136 |
private int[] mNumOccurences; |
|
135 | 137 |
|
136 | 138 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
137 | 139 |
|
... | ... | |
370 | 372 |
return BASIC_ANGLE; |
371 | 373 |
} |
372 | 374 |
|
375 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
376 |
|
|
377 |
private void initializeScrambling() |
|
378 |
{ |
|
379 |
int numLayers = getNumLayers(); |
|
380 |
|
|
381 |
if( mScrambleTable ==null ) |
|
382 |
{ |
|
383 |
mScrambleTable = new int[NUM_AXIS][numLayers]; |
|
384 |
} |
|
385 |
if( mNumOccurences ==null ) |
|
386 |
{ |
|
387 |
int max=0; |
|
388 |
|
|
389 |
for (ScrambleState mState : mStates) |
|
390 |
{ |
|
391 |
int tmp = mState.getTotal(-1); |
|
392 |
if (max < tmp) max = tmp; |
|
393 |
} |
|
394 |
|
|
395 |
mNumOccurences = new int[max]; |
|
396 |
} |
|
397 |
|
|
398 |
for(int i=0; i<NUM_AXIS; i++) |
|
399 |
for(int j=0; j<numLayers; j++) mScrambleTable[i][j] = 0; |
|
400 |
} |
|
401 |
|
|
373 | 402 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
374 | 403 |
|
375 | 404 |
public void randomizeNewScramble(int[][] scramble, Random rnd, int curr, int totalScrambles) |
... | ... | |
378 | 407 |
{ |
379 | 408 |
mCurrState = 0; |
380 | 409 |
mIndexExcluded =-1; |
410 |
initializeScrambling(); |
|
381 | 411 |
} |
382 | 412 |
|
383 |
int total = mStates[mCurrState].getTotal(mIndexExcluded); |
|
384 |
int random= rnd.nextInt(total); |
|
385 |
int[] info= mStates[mCurrState].getInfo(random,mIndexExcluded); |
|
413 |
int[] info= mStates[mCurrState].getRandom(rnd, mIndexExcluded, mScrambleTable, mNumOccurences); |
|
386 | 414 |
|
387 | 415 |
scramble[curr][0] = info[0]; |
388 | 416 |
scramble[curr][1] = info[1]; |
src/main/java/org/distorted/objects/TwistyDiamond.java | ||
---|---|---|
139 | 139 |
private int mCurrState; |
140 | 140 |
private int mIndexExcluded; |
141 | 141 |
private final ScrambleState[] mStates; |
142 |
private int[][] mScrambleTable; |
|
143 |
private int[] mNumOccurences; |
|
142 | 144 |
|
143 | 145 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
144 | 146 |
|
... | ... | |
518 | 520 |
} |
519 | 521 |
|
520 | 522 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
521 |
// PUBLIC API |
|
522 | 523 |
|
523 |
public Static3D[] getRotationAxis()
|
|
524 |
private void initializeScrambling()
|
|
524 | 525 |
{ |
525 |
return ROT_AXIS; |
|
526 |
} |
|
526 |
int numLayers = getNumLayers(); |
|
527 | 527 |
|
528 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
528 |
if( mScrambleTable ==null ) |
|
529 |
{ |
|
530 |
mScrambleTable = new int[NUM_AXIS][numLayers]; |
|
531 |
} |
|
532 |
if( mNumOccurences ==null ) |
|
533 |
{ |
|
534 |
int max=0; |
|
529 | 535 |
|
530 |
public int[] getBasicAngle() |
|
531 |
{ |
|
532 |
return BASIC_ANGLE; |
|
536 |
for (ScrambleState mState : mStates) |
|
537 |
{ |
|
538 |
int tmp = mState.getTotal(-1); |
|
539 |
if (max < tmp) max = tmp; |
|
540 |
} |
|
541 |
|
|
542 |
mNumOccurences = new int[max]; |
|
543 |
} |
|
544 |
|
|
545 |
for(int i=0; i<NUM_AXIS; i++) |
|
546 |
for(int j=0; j<numLayers; j++) mScrambleTable[i][j] = 0; |
|
533 | 547 |
} |
534 | 548 |
|
535 | 549 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
550 |
// PUBLIC API |
|
536 | 551 |
|
537 | 552 |
public void randomizeNewScramble(int[][] scramble, Random rnd, int curr, int totalScrambles) |
538 | 553 |
{ |
... | ... | |
540 | 555 |
{ |
541 | 556 |
mCurrState = 0; |
542 | 557 |
mIndexExcluded =-1; |
558 |
initializeScrambling(); |
|
543 | 559 |
} |
544 | 560 |
|
545 |
int total = mStates[mCurrState].getTotal(mIndexExcluded); |
|
546 |
int random= rnd.nextInt(total); |
|
547 |
int[] info= mStates[mCurrState].getInfo(random,mIndexExcluded); |
|
561 |
int[] info= mStates[mCurrState].getRandom(rnd, mIndexExcluded, mScrambleTable, mNumOccurences); |
|
548 | 562 |
|
549 | 563 |
scramble[curr][0] = info[0]; |
550 | 564 |
scramble[curr][1] = info[1]; |
... | ... | |
554 | 568 |
mIndexExcluded = info[0]; |
555 | 569 |
} |
556 | 570 |
|
571 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
572 |
|
|
573 |
public Static3D[] getRotationAxis() |
|
574 |
{ |
|
575 |
return ROT_AXIS; |
|
576 |
} |
|
577 |
|
|
578 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
579 |
|
|
580 |
public int[] getBasicAngle() |
|
581 |
{ |
|
582 |
return BASIC_ANGLE; |
|
583 |
} |
|
584 |
|
|
557 | 585 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
558 | 586 |
|
559 | 587 |
public int getObjectName(int numLayers) |
src/main/java/org/distorted/objects/TwistyHelicopter.java | ||
---|---|---|
239 | 239 |
private int mCurrState; |
240 | 240 |
private int mIndexExcluded; |
241 | 241 |
private final ScrambleState[] mStates; |
242 |
private int[][] mScrambleTable; |
|
243 |
private int[] mNumOccurences; |
|
242 | 244 |
|
243 | 245 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
244 | 246 |
|
... | ... | |
415 | 417 |
} |
416 | 418 |
|
417 | 419 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
418 |
// PUBLIC API |
|
419 | 420 |
|
420 |
public Static3D[] getRotationAxis()
|
|
421 |
private void initializeScrambling()
|
|
421 | 422 |
{ |
422 |
return ROT_AXIS; |
|
423 |
} |
|
423 |
int numLayers = getNumLayers(); |
|
424 | 424 |
|
425 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
425 |
if( mScrambleTable ==null ) |
|
426 |
{ |
|
427 |
mScrambleTable = new int[NUM_AXIS][numLayers]; |
|
428 |
} |
|
429 |
if( mNumOccurences ==null ) |
|
430 |
{ |
|
431 |
int max=0; |
|
426 | 432 |
|
427 |
public int[] getBasicAngle() |
|
428 |
{ |
|
429 |
return BASIC_ANGLE; |
|
433 |
for (ScrambleState mState : mStates) |
|
434 |
{ |
|
435 |
int tmp = mState.getTotal(-1); |
|
436 |
if (max < tmp) max = tmp; |
|
437 |
} |
|
438 |
|
|
439 |
mNumOccurences = new int[max]; |
|
440 |
} |
|
441 |
|
|
442 |
for(int i=0; i<NUM_AXIS; i++) |
|
443 |
for(int j=0; j<numLayers; j++) mScrambleTable[i][j] = 0; |
|
430 | 444 |
} |
431 | 445 |
|
432 | 446 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
447 |
// PUBLIC API |
|
433 | 448 |
|
434 | 449 |
public void randomizeNewScramble(int[][] scramble, Random rnd, int curr, int totalScrambles) |
435 | 450 |
{ |
... | ... | |
437 | 452 |
{ |
438 | 453 |
mCurrState = 0; |
439 | 454 |
mIndexExcluded =-1; |
455 |
initializeScrambling(); |
|
440 | 456 |
} |
441 | 457 |
|
442 |
int total = mStates[mCurrState].getTotal(mIndexExcluded); |
|
443 |
int random= rnd.nextInt(total); |
|
444 |
int[] info= mStates[mCurrState].getInfo(random,mIndexExcluded); |
|
458 |
int[] info= mStates[mCurrState].getRandom(rnd, mIndexExcluded, mScrambleTable, mNumOccurences); |
|
445 | 459 |
|
446 | 460 |
scramble[curr][0] = info[0]; |
447 | 461 |
scramble[curr][1] = info[1]; |
... | ... | |
451 | 465 |
mIndexExcluded = info[0]; |
452 | 466 |
} |
453 | 467 |
|
468 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
469 |
|
|
470 |
public Static3D[] getRotationAxis() |
|
471 |
{ |
|
472 |
return ROT_AXIS; |
|
473 |
} |
|
474 |
|
|
475 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
476 |
|
|
477 |
public int[] getBasicAngle() |
|
478 |
{ |
|
479 |
return BASIC_ANGLE; |
|
480 |
} |
|
481 |
|
|
454 | 482 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
455 | 483 |
|
456 | 484 |
public int getObjectName(int numLayers) |
src/main/java/org/distorted/objects/TwistyIvy.java | ||
---|---|---|
120 | 120 |
private int mCurrState; |
121 | 121 |
private int mIndexExcluded; |
122 | 122 |
private final ScrambleState[] mStates; |
123 |
private int[][] mScrambleTable; |
|
124 |
private int[] mNumOccurences; |
|
123 | 125 |
|
124 | 126 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
125 | 127 |
|
... | ... | |
446 | 448 |
} |
447 | 449 |
|
448 | 450 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
449 |
// PUBLIC API |
|
450 | 451 |
|
451 |
public Static3D[] getRotationAxis()
|
|
452 |
private void initializeScrambling()
|
|
452 | 453 |
{ |
453 |
return ROT_AXIS; |
|
454 |
} |
|
454 |
int numLayers = getNumLayers(); |
|
455 | 455 |
|
456 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
456 |
if( mScrambleTable ==null ) |
|
457 |
{ |
|
458 |
mScrambleTable = new int[NUM_AXIS][numLayers]; |
|
459 |
} |
|
460 |
if( mNumOccurences ==null ) |
|
461 |
{ |
|
462 |
int max=0; |
|
457 | 463 |
|
458 |
public int[] getBasicAngle() |
|
459 |
{ |
|
460 |
return BASIC_ANGLE; |
|
464 |
for (ScrambleState mState : mStates) |
|
465 |
{ |
|
466 |
int tmp = mState.getTotal(-1); |
|
467 |
if (max < tmp) max = tmp; |
|
468 |
} |
|
469 |
|
|
470 |
mNumOccurences = new int[max]; |
|
471 |
} |
|
472 |
|
|
473 |
for(int i=0; i<NUM_AXIS; i++) |
|
474 |
for(int j=0; j<numLayers; j++) mScrambleTable[i][j] = 0; |
|
461 | 475 |
} |
462 | 476 |
|
463 | 477 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
478 |
// PUBLIC API |
|
464 | 479 |
|
465 | 480 |
public void randomizeNewScramble(int[][] scramble, Random rnd, int curr, int totalScrambles) |
466 | 481 |
{ |
... | ... | |
468 | 483 |
{ |
469 | 484 |
mCurrState = 0; |
470 | 485 |
mIndexExcluded =-1; |
486 |
initializeScrambling(); |
|
471 | 487 |
} |
472 | 488 |
|
473 |
int total = mStates[mCurrState].getTotal(mIndexExcluded); |
|
474 |
int random= rnd.nextInt(total); |
|
475 |
int[] info= mStates[mCurrState].getInfo(random,mIndexExcluded); |
|
489 |
int[] info= mStates[mCurrState].getRandom(rnd, mIndexExcluded, mScrambleTable, mNumOccurences); |
|
476 | 490 |
|
477 | 491 |
scramble[curr][0] = info[0]; |
478 | 492 |
scramble[curr][1] = info[1]; |
... | ... | |
482 | 496 |
mIndexExcluded = info[0]; |
483 | 497 |
} |
484 | 498 |
|
499 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
500 |
|
|
501 |
public Static3D[] getRotationAxis() |
|
502 |
{ |
|
503 |
return ROT_AXIS; |
|
504 |
} |
|
505 |
|
|
506 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
507 |
|
|
508 |
public int[] getBasicAngle() |
|
509 |
{ |
|
510 |
return BASIC_ANGLE; |
|
511 |
} |
|
512 |
|
|
485 | 513 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
486 | 514 |
|
487 | 515 |
public int getObjectName(int numLayers) |
src/main/java/org/distorted/objects/TwistyJing.java | ||
---|---|---|
219 | 219 |
private int mCurrState; |
220 | 220 |
private int mIndexExcluded; |
221 | 221 |
private final ScrambleState[] mStates; |
222 |
private int[][] mScrambleTable; |
|
223 |
private int[] mNumOccurences; |
|
222 | 224 |
|
223 | 225 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
224 | 226 |
|
... | ... | |
396 | 398 |
} |
397 | 399 |
|
398 | 400 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
399 |
// PUBLIC API |
|
400 | 401 |
|
401 |
public Static3D[] getRotationAxis()
|
|
402 |
private void initializeScrambling()
|
|
402 | 403 |
{ |
403 |
return ROT_AXIS; |
|
404 |
} |
|
404 |
int numLayers = getNumLayers(); |
|
405 | 405 |
|
406 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
406 |
if( mScrambleTable ==null ) |
|
407 |
{ |
|
408 |
mScrambleTable = new int[NUM_AXIS][numLayers]; |
|
409 |
} |
|
410 |
if( mNumOccurences ==null ) |
|
411 |
{ |
|
412 |
int max=0; |
|
407 | 413 |
|
408 |
public int[] getBasicAngle() |
|
409 |
{ |
|
410 |
return BASIC_ANGLE; |
|
414 |
for (ScrambleState mState : mStates) |
|
415 |
{ |
|
416 |
int tmp = mState.getTotal(-1); |
|
417 |
if (max < tmp) max = tmp; |
|
418 |
} |
|
419 |
|
|
420 |
mNumOccurences = new int[max]; |
|
421 |
} |
|
422 |
|
|
423 |
for(int i=0; i<NUM_AXIS; i++) |
|
424 |
for(int j=0; j<numLayers; j++) mScrambleTable[i][j] = 0; |
|
411 | 425 |
} |
412 | 426 |
|
413 | 427 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
428 |
// PUBLIC API |
|
414 | 429 |
|
415 | 430 |
public void randomizeNewScramble(int[][] scramble, Random rnd, int curr, int totalScrambles) |
416 | 431 |
{ |
... | ... | |
418 | 433 |
{ |
419 | 434 |
mCurrState = 0; |
420 | 435 |
mIndexExcluded =-1; |
436 |
initializeScrambling(); |
|
421 | 437 |
} |
422 | 438 |
|
423 |
int total = mStates[mCurrState].getTotal(mIndexExcluded); |
|
424 |
int random= rnd.nextInt(total); |
|
425 |
int[] info= mStates[mCurrState].getInfo(random,mIndexExcluded); |
|
439 |
int[] info= mStates[mCurrState].getRandom(rnd, mIndexExcluded, mScrambleTable, mNumOccurences); |
|
426 | 440 |
|
427 | 441 |
scramble[curr][0] = info[0]; |
428 | 442 |
scramble[curr][1] = info[1]; |
... | ... | |
432 | 446 |
mIndexExcluded = info[0]; |
433 | 447 |
} |
434 | 448 |
|
449 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
450 |
|
|
451 |
public Static3D[] getRotationAxis() |
|
452 |
{ |
|
453 |
return ROT_AXIS; |
|
454 |
} |
|
455 |
|
|
456 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
457 |
|
|
458 |
public int[] getBasicAngle() |
|
459 |
{ |
|
460 |
return BASIC_ANGLE; |
|
461 |
} |
|
462 |
|
|
435 | 463 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
436 | 464 |
|
437 | 465 |
public int getObjectName(int numLayers) |
src/main/java/org/distorted/objects/TwistyRex.java | ||
---|---|---|
156 | 156 |
private int mCurrState; |
157 | 157 |
private int mIndexExcluded; |
158 | 158 |
private final ScrambleState[] mStates; |
159 |
private int[][] mScrambleTable; |
|
160 |
private int[] mNumOccurences; |
|
159 | 161 |
|
160 | 162 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
161 | 163 |
|
... | ... | |
477 | 479 |
} |
478 | 480 |
|
479 | 481 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
480 |
// PUBLIC API |
|
481 | 482 |
|
482 |
public Static3D[] getRotationAxis()
|
|
483 |
private void initializeScrambling()
|
|
483 | 484 |
{ |
484 |
return ROT_AXIS; |
|
485 |
} |
|
485 |
int numLayers = getNumLayers(); |
|
486 | 486 |
|
487 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
487 |
if( mScrambleTable ==null ) |
|
488 |
{ |
|
489 |
mScrambleTable = new int[NUM_AXIS][numLayers]; |
|
490 |
} |
|
491 |
if( mNumOccurences ==null ) |
|
492 |
{ |
|
493 |
int max=0; |
|
488 | 494 |
|
489 |
public int[] getBasicAngle() |
|
490 |
{ |
|
491 |
return BASIC_ANGLE; |
|
495 |
for (ScrambleState mState : mStates) |
|
496 |
{ |
|
497 |
int tmp = mState.getTotal(-1); |
|
498 |
if (max < tmp) max = tmp; |
|
499 |
} |
|
500 |
|
|
501 |
mNumOccurences = new int[max]; |
|
502 |
} |
|
503 |
|
|
504 |
for(int i=0; i<NUM_AXIS; i++) |
|
505 |
for(int j=0; j<numLayers; j++) mScrambleTable[i][j] = 0; |
|
492 | 506 |
} |
493 | 507 |
|
494 | 508 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
509 |
// PUBLIC API |
|
495 | 510 |
|
496 | 511 |
public void randomizeNewScramble(int[][] scramble, Random rnd, int curr, int totalScrambles) |
497 | 512 |
{ |
... | ... | |
499 | 514 |
{ |
500 | 515 |
mCurrState = 0; |
501 | 516 |
mIndexExcluded =-1; |
517 |
initializeScrambling(); |
|
502 | 518 |
} |
503 | 519 |
|
504 |
int total = mStates[mCurrState].getTotal(mIndexExcluded); |
|
505 |
int random= rnd.nextInt(total); |
|
506 |
int[] info= mStates[mCurrState].getInfo(random,mIndexExcluded); |
|
520 |
int[] info= mStates[mCurrState].getRandom(rnd, mIndexExcluded, mScrambleTable, mNumOccurences); |
|
507 | 521 |
|
508 | 522 |
scramble[curr][0] = info[0]; |
509 | 523 |
scramble[curr][1] = info[1]; |
... | ... | |
513 | 527 |
mIndexExcluded = info[0]; |
514 | 528 |
} |
515 | 529 |
|
530 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
531 |
|
|
532 |
public Static3D[] getRotationAxis() |
|
533 |
{ |
|
534 |
return ROT_AXIS; |
|
535 |
} |
|
536 |
|
|
537 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
538 |
|
|
539 |
public int[] getBasicAngle() |
|
540 |
{ |
|
541 |
return BASIC_ANGLE; |
|
542 |
} |
|
543 |
|
|
516 | 544 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
517 | 545 |
|
518 | 546 |
public int getObjectName(int numLayers) |
src/main/java/org/distorted/objects/TwistySkewb.java | ||
---|---|---|
193 | 193 |
private int mCurrState; |
194 | 194 |
private int mIndexExcluded; |
195 | 195 |
private final ScrambleState[] mStates; |
196 |
private int[][] mScrambleTable; |
|
197 |
private int[] mNumOccurences; |
|
196 | 198 |
|
197 | 199 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
198 | 200 |
|
... | ... | |
595 | 597 |
} |
596 | 598 |
|
597 | 599 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
598 |
// PUBLIC API |
|
599 | 600 |
|
600 |
public Static3D[] getRotationAxis()
|
|
601 |
private void initializeScrambling()
|
|
601 | 602 |
{ |
602 |
return ROT_AXIS; |
|
603 |
} |
|
603 |
int numLayers = getNumLayers(); |
|
604 | 604 |
|
605 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
605 |
if( mScrambleTable ==null ) |
|
606 |
{ |
|
607 |
mScrambleTable = new int[NUM_AXIS][numLayers]; |
|
608 |
} |
|
609 |
if( mNumOccurences ==null ) |
|
610 |
{ |
|
611 |
int max=0; |
|
606 | 612 |
|
607 |
public int[] getBasicAngle() |
|
608 |
{ |
|
609 |
return BASIC_ANGLE; |
|
613 |
for (ScrambleState mState : mStates) |
|
614 |
{ |
|
615 |
int tmp = mState.getTotal(-1); |
|
616 |
if (max < tmp) max = tmp; |
|
617 |
} |
|
618 |
|
|
619 |
mNumOccurences = new int[max]; |
|
620 |
} |
|
621 |
|
|
622 |
for(int i=0; i<NUM_AXIS; i++) |
|
623 |
for(int j=0; j<numLayers; j++) mScrambleTable[i][j] = 0; |
|
610 | 624 |
} |
611 | 625 |
|
612 | 626 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
627 |
// PUBLIC API |
|
613 | 628 |
|
614 | 629 |
public void randomizeNewScramble(int[][] scramble, Random rnd, int curr, int totalScrambles) |
615 | 630 |
{ |
... | ... | |
617 | 632 |
{ |
618 | 633 |
mCurrState = 0; |
619 | 634 |
mIndexExcluded =-1; |
635 |
initializeScrambling(); |
|
620 | 636 |
} |
621 | 637 |
|
622 |
int total = mStates[mCurrState].getTotal(mIndexExcluded); |
|
623 |
int random= rnd.nextInt(total); |
|
624 |
int[] info= mStates[mCurrState].getInfo(random,mIndexExcluded); |
|
638 |
int[] info= mStates[mCurrState].getRandom(rnd, mIndexExcluded, mScrambleTable, mNumOccurences); |
|
625 | 639 |
|
626 | 640 |
scramble[curr][0] = info[0]; |
627 | 641 |
scramble[curr][1] = info[1]; |
... | ... | |
631 | 645 |
mIndexExcluded = info[0]; |
632 | 646 |
} |
633 | 647 |
|
648 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
649 |
|
|
650 |
public Static3D[] getRotationAxis() |
|
651 |
{ |
|
652 |
return ROT_AXIS; |
|
653 |
} |
|
654 |
|
|
655 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
656 |
|
|
657 |
public int[] getBasicAngle() |
|
658 |
{ |
|
659 |
return BASIC_ANGLE; |
|
660 |
} |
|
661 |
|
|
634 | 662 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
635 | 663 |
|
636 | 664 |
public int getObjectName(int numLayers) |
src/main/java/org/distorted/objects/TwistyUltimate.java | ||
---|---|---|
236 | 236 |
private int mCurrState; |
237 | 237 |
private int mIndexExcluded; |
238 | 238 |
private final ScrambleState[] mStates; |
239 |
private int[][] mScrambleTable; |
|
240 |
private int[] mNumOccurences; |
|
239 | 241 |
|
240 | 242 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
241 | 243 |
|
... | ... | |
412 | 414 |
} |
413 | 415 |
|
414 | 416 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
415 |
// PUBLIC API |
|
416 | 417 |
|
417 |
public Static3D[] getRotationAxis()
|
|
418 |
private void initializeScrambling()
|
|
418 | 419 |
{ |
419 |
return ROT_AXIS; |
|
420 |
} |
|
420 |
int numLayers = getNumLayers(); |
|
421 | 421 |
|
422 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
422 |
if( mScrambleTable ==null ) |
|
423 |
{ |
|
424 |
mScrambleTable = new int[NUM_AXIS][numLayers]; |
|
425 |
} |
|
426 |
if( mNumOccurences ==null ) |
|
427 |
{ |
|
428 |
int max=0; |
|
423 | 429 |
|
424 |
public int[] getBasicAngle() |
|
425 |
{ |
|
426 |
return BASIC_ANGLE; |
|
430 |
for (ScrambleState mState : mStates) |
|
431 |
{ |
|
432 |
int tmp = mState.getTotal(-1); |
|
433 |
if (max < tmp) max = tmp; |
|
434 |
} |
|
435 |
|
|
436 |
mNumOccurences = new int[max]; |
|
437 |
} |
|
438 |
|
|
439 |
for(int i=0; i<NUM_AXIS; i++) |
|
440 |
for(int j=0; j<numLayers; j++) mScrambleTable[i][j] = 0; |
|
427 | 441 |
} |
428 | 442 |
|
429 | 443 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
444 |
// PUBLIC API |
|
430 | 445 |
|
431 | 446 |
public void randomizeNewScramble(int[][] scramble, Random rnd, int curr, int totalScrambles) |
432 | 447 |
{ |
... | ... | |
434 | 449 |
{ |
435 | 450 |
mCurrState = 0; |
436 | 451 |
mIndexExcluded =-1; |
452 |
initializeScrambling(); |
|
437 | 453 |
} |
438 | 454 |
|
439 |
int total = mStates[mCurrState].getTotal(mIndexExcluded); |
|
440 |
int random= rnd.nextInt(total); |
|
441 |
int[] info= mStates[mCurrState].getInfo(random,mIndexExcluded); |
|
455 |
int[] info= mStates[mCurrState].getRandom(rnd, mIndexExcluded, mScrambleTable, mNumOccurences); |
|
442 | 456 |
|
443 | 457 |
scramble[curr][0] = info[0]; |
444 | 458 |
scramble[curr][1] = info[1]; |
... | ... | |
448 | 462 |
mIndexExcluded = info[0]; |
449 | 463 |
} |
450 | 464 |
|
465 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
466 |
|
|
467 |
public Static3D[] getRotationAxis() |
|
468 |
{ |
|
469 |
return ROT_AXIS; |
|
470 |
} |
|
471 |
|
|
472 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
473 |
|
|
474 |
public int[] getBasicAngle() |
|
475 |
{ |
|
476 |
return BASIC_ANGLE; |
|
477 |
} |
|
478 |
|
|
451 | 479 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
452 | 480 |
|
453 | 481 |
public int getObjectName(int numLayers) |
Also available in: Unified diff
Introduce pseudorandom balancing into scrambling to all the other already converted objects, i.e. everytihng except for Pyraminxes, Squares, Minxes and the Redi.