Project

General

Profile

« Previous | Next » 

Revision 1b5f9f0e

Added by Leszek Koltunski over 1 year ago

Support for multi-step scrambling algorithms.

View differences:

src/main/java/org/distorted/objectlib/scrambling/ObjectScrambler.java
30 30
  private int[][] mScrambleTable;
31 31
  private int[] mNumOccurences;
32 32
  private int[] mResult;
33
  private int mCurrAlgorithm;
34
  private int mCurrStep;
33 35

  
34 36
  // type=1, i.e. the exception: Square-1
35 37
  private static final int BASIC_ANGLE = 12;
......
120 122
      initializeScrambling();
121 123
      }
122 124

  
123
    mStates[mCurrState].getRandom(rnd, mAlgorithms, mAxisExcluded, mScrambleTable, mNumOccurences, mResult);
124
    int[] algorithm = mAlgorithms[mResult[0]];
125
    if( mCurrStep+6 <= mAlgorithms[mCurrAlgorithm].length )
126
      {
127
      mCurrStep += 3;
128
      }
129
    else
130
      {
131
      mStates[mCurrState].getRandom(rnd, mAlgorithms, mAxisExcluded, mScrambleTable, mNumOccurences, mResult);
132
      mCurrAlgorithm = mResult[0];
133
      mCurrState     = mResult[1];
134
      mCurrStep      = 0;
135
      }
125 136

  
126
    scramble[curr][0] = algorithm[0];
127
    scramble[curr][1] = algorithm[1];
128
    scramble[curr][2] = algorithm[2];
137
    int[] algorithm = mAlgorithms[mCurrAlgorithm];
138
    scramble[curr][0] = algorithm[mCurrStep  ];
139
    scramble[curr][1] = algorithm[mCurrStep+1];
140
    scramble[curr][2] = algorithm[mCurrStep+2];
129 141

  
130
    mCurrState    = mResult[1];
131 142
    mAxisExcluded = algorithm[0];
132 143
    }
133 144

  

Also available in: Unified diff