Revision e1dc3366
Added by Leszek Koltunski over 2 years ago
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.