Project

General

Profile

« Previous | Next » 

Revision 38589947

Added by Leszek Koltunski over 2 years ago

Unify scrambling across all 4 bandaged objects.

View differences:

src/main/java/org/distorted/objects/TwistyBandagedEvil.java
34 34

  
35 35
class TwistyBandagedEvil extends TwistyBandagedAbstract
36 36
{
37
   private int mCurrState;
38
   private int mIndexExcluded;
37
  private static final float[][] POSITIONS = new float[][]
38
      {
39
        { 1.0f,  1.0f, -1.0f},
40
        {-1.0f, -1.0f,  0.0f, -1.0f,  0.0f,  0.0f, 0.0f, -1.0f,  0.0f,  0.0f,  0.0f,  0.0f},
41
        {-1.0f,  1.0f, -1.0f,  0.0f,  1.0f, -1.0f},
42
        {-1.0f,  0.0f, -1.0f,  0.0f,  0.0f, -1.0f},
43
        {-1.0f, -1.0f, -1.0f,  0.0f, -1.0f, -1.0f},
44
        {-1.0f,  1.0f,  0.0f, -1.0f,  1.0f,  1.0f},
45
        { 0.0f,  1.0f,  0.0f,  0.0f,  1.0f,  1.0f},
46
        { 1.0f,  1.0f,  0.0f,  1.0f,  1.0f,  1.0f},
47
        {-1.0f, -1.0f,  1.0f, -1.0f,  0.0f,  1.0f},
48
        { 0.0f, -1.0f,  1.0f,  0.0f,  0.0f,  1.0f},
49
        { 1.0f, -1.0f,  1.0f,  1.0f,  0.0f,  1.0f},
50
        { 1.0f, -1.0f,  0.0f,  1.0f,  0.0f,  0.0f},
51
        { 1.0f, -1.0f, -1.0f,  1.0f,  0.0f, -1.0f}
52
      };
39 53

  
40
   // The list of all 'significant' states of the Evil Cube, just like in the 3Plate Cube class.
41
   // This time the list got computed automatically - by the ScrambleStateGraphProducer.computeGraph().
54
  private static final int[] QUAT_INDICES = new int[]
55
      { 0, 1, 0, 0, 0, 2, 2, 2, 3, 3, 3, 3, 3 };
56

  
57
///////////////////////////////////////////////////////////////////////////////////////////////////
58

  
59
  TwistyBandagedEvil(int size, Static4D quat, DistortedTexture texture, MeshSquare mesh,
60
                     DistortedEffects effects, int[][] moves, Resources res, int scrWidth)
61
    {
62
    super(size, quat, texture, mesh, effects, moves, ObjectList.BAN4, res, scrWidth);
42 63

  
43
   private final ScrambleStateGraph[] mStates = new ScrambleStateGraph[]
64
    mStates = new ScrambleStateGraph[]
44 65
     {
45 66
     new ScrambleStateGraph( new int[][] {{2, 1,  1,2,-1,  2}         , {2, 2,142,2,-1, 28}         , {0, 1,114}          }),   //0
46 67
     new ScrambleStateGraph( new int[][] {{2, 2,  2}                  , {2,-1,143}                  , {}                  }),
......
187 208
     new ScrambleStateGraph( new int[][] {{}                          , {2, 1, 28}                  , {2,-1, 18}          }),
188 209
     new ScrambleStateGraph( new int[][] {{}                          , {2, 1,  1}                  , {2, 2, 12,2,-1, 13} })
189 210
     };
190

  
191
///////////////////////////////////////////////////////////////////////////////////////////////////
192

  
193
  private static final float[][] POSITIONS = new float[][]
194
      {
195
        { 1.0f,  1.0f, -1.0f},
196
        {-1.0f, -1.0f,  0.0f, -1.0f,  0.0f,  0.0f, 0.0f, -1.0f,  0.0f,  0.0f,  0.0f,  0.0f},
197
        {-1.0f,  1.0f, -1.0f,  0.0f,  1.0f, -1.0f},
198
        {-1.0f,  0.0f, -1.0f,  0.0f,  0.0f, -1.0f},
199
        {-1.0f, -1.0f, -1.0f,  0.0f, -1.0f, -1.0f},
200
        {-1.0f,  1.0f,  0.0f, -1.0f,  1.0f,  1.0f},
201
        { 0.0f,  1.0f,  0.0f,  0.0f,  1.0f,  1.0f},
202
        { 1.0f,  1.0f,  0.0f,  1.0f,  1.0f,  1.0f},
203
        {-1.0f, -1.0f,  1.0f, -1.0f,  0.0f,  1.0f},
204
        { 0.0f, -1.0f,  1.0f,  0.0f,  0.0f,  1.0f},
205
        { 1.0f, -1.0f,  1.0f,  1.0f,  0.0f,  1.0f},
206
        { 1.0f, -1.0f,  0.0f,  1.0f,  0.0f,  0.0f},
207
        { 1.0f, -1.0f, -1.0f,  1.0f,  0.0f, -1.0f}
208
      };
209

  
210
  private static final int[] QUAT_INDICES = new int[]
211
      { 0, 1, 0, 0, 0, 2, 2, 2, 3, 3, 3, 3, 3 };
212

  
213
///////////////////////////////////////////////////////////////////////////////////////////////////
214

  
215
  TwistyBandagedEvil(int size, Static4D quat, DistortedTexture texture, MeshSquare mesh,
216
                     DistortedEffects effects, int[][] moves, Resources res, int scrWidth)
217
    {
218
    super(size, quat, texture, mesh, effects, moves, ObjectList.BAN4, res, scrWidth);
219 211
    }
220 212

  
221 213
///////////////////////////////////////////////////////////////////////////////////////////////////
......
235 227
///////////////////////////////////////////////////////////////////////////////////////////////////
236 228
// PUBLIC API
237 229

  
238
  public void randomizeNewScramble(int[][] scramble, Random rnd, int curr, int totalScrambles)
239
    {
240
    if( curr==0 )
241
      {
242
      mCurrState     = 0;
243
      mIndexExcluded =-1;
244
      }
245

  
246
    int total = mStates[mCurrState].getTotal(mIndexExcluded);
247
    int random= rnd.nextInt(total);
248
    int[] info= mStates[mCurrState].getInfo(random,mIndexExcluded);
249

  
250
    scramble[curr][0] = info[0];
251
    scramble[curr][1] = info[1];
252
    scramble[curr][2] = info[2];
253

  
254
    mCurrState     = info[3];
255
    mIndexExcluded = info[0];
256
    }
257

  
258
///////////////////////////////////////////////////////////////////////////////////////////////////
259

  
260 230
  public int getObjectName(int numLayers)
261 231
    {
262 232
    return R.string.bandaged_evil;

Also available in: Unified diff