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/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)

Also available in: Unified diff