Project

General

Profile

« Previous | Next » 

Revision e1dc3366

Added by Leszek Koltunski over 2 years ago

Introduce pseudorandom balancing into scrambling to all the other already converted objects, i.e. everytihng except for Pyraminxes, Squares, Minxes and the Redi.

View differences:

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)

Also available in: Unified diff