Project

General

Profile

« Previous | Next » 

Revision 91792184

Added by Leszek Koltunski over 2 years ago

Make object scrambling abstract (well, almost - with exception of Square-1 - this theoretically could also be done the generic way, but this would require almost 20000 'ScrambleStates')

View differences:

src/main/java/org/distorted/objects/TwistyBandaged2Bar.java
36 36
                     DistortedEffects effects, int[][] moves, Resources res, int scrWidth)
37 37
    {
38 38
    super(size, quat, texture, mesh, effects, moves, ObjectList.BAN2, res, scrWidth);
39
    }
40

  
41
///////////////////////////////////////////////////////////////////////////////////////////////////
39 42

  
40
    mStates = new ScrambleState[]
43
  ScrambleState[] getScrambleStates()
44
    {
45
    if( mStates==null )
41 46
      {
42
      new ScrambleState( new int[][] { {}                                          , {0,1,1, 0,-1,1, 2,1,2, 2,-1,2}, {} }),
43
      new ScrambleState( new int[][] { {0,-1,1, 0,1,1, 0,2,1, 2,-1,1, 2,1,1, 2,2,1}, {0,2,1, 2,2,1}                , {} }),
44
      new ScrambleState( new int[][] { {}, {0,2,2, 2,2,2}                , {0,-1,2, 0,1,2, 0,2,2, 2,-1,2, 2,1,2, 2,2,2} })
45
      };
47
      mStates = new ScrambleState[]
48
        {
49
        new ScrambleState( new int[][] { {}                                          , {0,1,1, 0,-1,1, 2,1,2, 2,-1,2}, {} }),
50
        new ScrambleState( new int[][] { {0,-1,1, 0,1,1, 0,2,1, 2,-1,1, 2,1,1, 2,2,1}, {0,2,1, 2,2,1}                , {} }),
51
        new ScrambleState( new int[][] { {}, {0,2,2, 2,2,2}                , {0,-1,2, 0,1,2, 0,2,2, 2,-1,2, 2,1,2, 2,2,2} })
52
        };
53
      }
54

  
55
    return mStates;
46 56
    }
47 57

  
48 58
///////////////////////////////////////////////////////////////////////////////////////////////////
src/main/java/org/distorted/objects/TwistyBandaged3Plate.java
36 36
                       DistortedEffects effects, int[][] moves, Resources res, int scrWidth)
37 37
    {
38 38
    super(size, quat, texture, mesh, effects, moves, ObjectList.BAN3, res, scrWidth);
39
    }
40

  
41
///////////////////////////////////////////////////////////////////////////////////////////////////
39 42

  
40
    mStates = new ScrambleState[]
43
  ScrambleState[] getScrambleStates()
41 44
    {
42
    new ScrambleState( new int[][] {{ 2,-1, 1, 2, 1, 6                  }, { 0,-1, 5, 0, 1, 3                  }, { 2,-1, 2, 2, 1, 4                  }} ),
43
    new ScrambleState( new int[][] {{ 2, 1, 0                           }, {                                   }, { 2, 1,10, 2, 2, 7                  }} ),
44
    new ScrambleState( new int[][] {{                                   }, { 0,-1,11, 0, 2, 8                  }, { 2, 1, 0                           }} ),
45
    new ScrambleState( new int[][] {{ 2, 1,12, 2, 2, 9                  }, { 0,-1, 0                           }, {                                   }} ),
46
    new ScrambleState( new int[][] {{ 2,-1,10, 2, 2,13                  }, {                                   }, { 2,-1, 0                           }} ),
47
    new ScrambleState( new int[][] {{                                   }, { 0, 1, 0                           }, { 2,-1,11, 2, 2,14                  }} ),
48
    new ScrambleState( new int[][] {{ 2,-1, 0                           }, { 0, 1,12, 0, 2,15                  }, {                                   }} ),
49
    new ScrambleState( new int[][] {{                                   }, { 2,-2, 7, 2,-1, 7, 2, 1, 7, 2, 2, 7}, { 2,-1,10, 2, 2, 1                  }} ),
50
    new ScrambleState( new int[][] {{ 0,-2, 8, 0,-1, 8, 0, 1, 8, 0, 2, 8}, { 0, 1,11, 0, 2, 2                  }, {                                   }} ),
51
    new ScrambleState( new int[][] {{ 2,-1,12, 2, 2, 3                  }, {                                   }, { 0,-2, 9, 0,-1, 9, 0, 1, 9, 0, 2, 9}} ),
52
    new ScrambleState( new int[][] {{ 2,-1,13, 2, 1, 4                  }, { 2,-2,10, 2,-1,10, 2, 1,10, 2, 2,10}, { 2,-1, 1, 2, 1, 7                  }} ),
53
    new ScrambleState( new int[][] {{ 0,-2,11, 0,-1,11, 0, 1,11, 0, 2,11}, { 0,-1, 8, 0, 1, 2                  }, { 2,-1,14, 2, 1, 5                  }} ),
54
    new ScrambleState( new int[][] {{ 2,-1, 3, 2, 1, 9                  }, { 0,-1, 6, 0, 1,15                  }, { 0,-2,12, 0,-1,12, 0, 1,12, 0, 2,12}} ),
55
    new ScrambleState( new int[][] {{ 2, 1,10, 2, 2, 4                  }, { 2,-2,13, 2,-1,13, 2, 1,13, 2, 2,13}, {                                   }} ),
56
    new ScrambleState( new int[][] {{ 0,-2,14, 0,-1,14, 0, 1,14, 0, 2,14}, {                                   }, { 2, 1,11, 2, 2, 5                  }} ),
57
    new ScrambleState( new int[][] {{                                   }, { 0,-1,12, 0, 2, 6                  }, { 0,-2,15, 0,-1,15, 0, 1,15, 0, 2,15}} )
58
    };
45
    if( mStates==null )
46
      {
47
      mStates = new ScrambleState[]
48
        {
49
        new ScrambleState( new int[][] {{ 2,-1, 1, 2, 1, 6                  }, { 0,-1, 5, 0, 1, 3                  }, { 2,-1, 2, 2, 1, 4                  }} ),
50
        new ScrambleState( new int[][] {{ 2, 1, 0                           }, {                                   }, { 2, 1,10, 2, 2, 7                  }} ),
51
        new ScrambleState( new int[][] {{                                   }, { 0,-1,11, 0, 2, 8                  }, { 2, 1, 0                           }} ),
52
        new ScrambleState( new int[][] {{ 2, 1,12, 2, 2, 9                  }, { 0,-1, 0                           }, {                                   }} ),
53
        new ScrambleState( new int[][] {{ 2,-1,10, 2, 2,13                  }, {                                   }, { 2,-1, 0                           }} ),
54
        new ScrambleState( new int[][] {{                                   }, { 0, 1, 0                           }, { 2,-1,11, 2, 2,14                  }} ),
55
        new ScrambleState( new int[][] {{ 2,-1, 0                           }, { 0, 1,12, 0, 2,15                  }, {                                   }} ),
56
        new ScrambleState( new int[][] {{                                   }, { 2,-2, 7, 2,-1, 7, 2, 1, 7, 2, 2, 7}, { 2,-1,10, 2, 2, 1                  }} ),
57
        new ScrambleState( new int[][] {{ 0,-2, 8, 0,-1, 8, 0, 1, 8, 0, 2, 8}, { 0, 1,11, 0, 2, 2                  }, {                                   }} ),
58
        new ScrambleState( new int[][] {{ 2,-1,12, 2, 2, 3                  }, {                                   }, { 0,-2, 9, 0,-1, 9, 0, 1, 9, 0, 2, 9}} ),
59
        new ScrambleState( new int[][] {{ 2,-1,13, 2, 1, 4                  }, { 2,-2,10, 2,-1,10, 2, 1,10, 2, 2,10}, { 2,-1, 1, 2, 1, 7                  }} ),
60
        new ScrambleState( new int[][] {{ 0,-2,11, 0,-1,11, 0, 1,11, 0, 2,11}, { 0,-1, 8, 0, 1, 2                  }, { 2,-1,14, 2, 1, 5                  }} ),
61
        new ScrambleState( new int[][] {{ 2,-1, 3, 2, 1, 9                  }, { 0,-1, 6, 0, 1,15                  }, { 0,-2,12, 0,-1,12, 0, 1,12, 0, 2,12}} ),
62
        new ScrambleState( new int[][] {{ 2, 1,10, 2, 2, 4                  }, { 2,-2,13, 2,-1,13, 2, 1,13, 2, 2,13}, {                                   }} ),
63
        new ScrambleState( new int[][] {{ 0,-2,14, 0,-1,14, 0, 1,14, 0, 2,14}, {                                   }, { 2, 1,11, 2, 2, 5                  }} ),
64
        new ScrambleState( new int[][] {{                                   }, { 0,-1,12, 0, 2, 6                  }, { 0,-2,15, 0,-1,15, 0, 1,15, 0, 2,15}} )
65
        };
66
      }
67

  
68
    return mStates;
59 69
    }
60 70

  
61 71
///////////////////////////////////////////////////////////////////////////////////////////////////
src/main/java/org/distorted/objects/TwistyBandagedAbstract.java
30 30
import org.distorted.library.type.Static3D;
31 31
import org.distorted.library.type.Static4D;
32 32

  
33
import java.util.Random;
34

  
35 33
///////////////////////////////////////////////////////////////////////////////////////////////////
36 34

  
37 35
abstract class TwistyBandagedAbstract extends TwistyObject
......
63 61
  private static final int NUM_STICKERS = 4;
64 62

  
65 63
  private int[] mBasicAngle;
66
  private int mCurrState;
67
  private int mIndexExcluded;
68
  private int[][] mScrambleTable;
69
  private int[] mNumOccurences;
70 64
  private Static4D[] mQuats;
71 65
  private ObjectSticker[] mStickers;
72 66
  private Static4D[] mInitQuats;
......
466 460
    return getNumLayers();
467 461
    }
468 462

  
469
///////////////////////////////////////////////////////////////////////////////////////////////////
470

  
471
  private void initializeScrambling()
472
    {
473
    int numLayers = getNumLayers();
474

  
475
    if( mScrambleTable ==null )
476
      {
477
      mScrambleTable = new int[NUM_AXIS][numLayers];
478
      }
479
    if( mNumOccurences ==null )
480
      {
481
      int max=0;
482

  
483
      for (ScrambleState mState : mStates)
484
        {
485
        int tmp = mState.getTotal(-1);
486
        if (max < tmp) max = tmp;
487
        }
488

  
489
      mNumOccurences = new int[max];
490
      }
491

  
492
    for(int i=0; i<NUM_AXIS; i++)
493
      for(int j=0; j<numLayers; j++) mScrambleTable[i][j] = 0;
494
    }
495

  
496 463
///////////////////////////////////////////////////////////////////////////////////////////////////
497 464
// PUBLIC API
498 465

  
499
  public void randomizeNewScramble(int[][] scramble, Random rnd, int curr, int totalScrambles)
500
    {
501
    if( curr==0 )
502
      {
503
      mCurrState     = 0;
504
      mIndexExcluded =-1;
505
      initializeScrambling();
506
      }
507

  
508
    int[] info= mStates[mCurrState].getRandom(rnd, mIndexExcluded, mScrambleTable, mNumOccurences);
509

  
510
    scramble[curr][0] = info[0];
511
    scramble[curr][1] = info[1];
512
    scramble[curr][2] = info[2];
513

  
514
    mCurrState     = info[3];
515
    mIndexExcluded = info[0];
516
    }
517

  
518
///////////////////////////////////////////////////////////////////////////////////////////////////
519

  
520 466
  public Static3D[] getRotationAxis()
521 467
    {
522 468
    return ROT_AXIS;
src/main/java/org/distorted/objects/TwistyBandagedEvil.java
36 36
                     DistortedEffects effects, int[][] moves, Resources res, int scrWidth)
37 37
    {
38 38
    super(size, quat, texture, mesh, effects, moves, ObjectList.BAN4, res, scrWidth);
39
    }
40

  
41
///////////////////////////////////////////////////////////////////////////////////////////////////
42

  
43
  ScrambleState[] getScrambleStates()
44
    {
45
    if( mStates==null )
46
      {
47
      mStates = new ScrambleState[]
48
        {
49
        new ScrambleState( new int[][] {{2, 1,  1,2,-1,  2}         , {2, 2,142,2,-1, 28}         , {0, 1,114}          }),   //0
50
        new ScrambleState( new int[][] {{2, 2,  2}                  , {2,-1,143}                  , {}                  }),
51
        new ScrambleState( new int[][] {{2, 2,  1}                  , {}                          , {0, 1,  3,0, 2, 47} }),
52
        new ScrambleState( new int[][] {{2, 1,  4}                  , {2, 1,132,2,-1,131}         , {0, 1, 47,0,-1,  2} }),
53
        new ScrambleState( new int[][] {{2,-1,  3}                  , {2, 1,  5,2,-1,  6}         , {}                  }),
54
        new ScrambleState( new int[][] {{}                          , {2, 2,  6,2,-1,  4}         , {0, 1, 51}          }),
55
        new ScrambleState( new int[][] {{}                          , {2, 1,  4,2, 2,  5}         , {2, 2,  7,2,-1, 80} }),
56
        new ScrambleState( new int[][] {{2, 2,  8}                  , {}                          , {2, 1, 80,2, 2,  6} }),
57
        new ScrambleState( new int[][] {{2, 2,  7}                  , {}                          , {0,-1,  9}          }),
58
        new ScrambleState( new int[][] {{2, 1, 10,2, 2, 11,2,-1, 12}, {}                          , {0, 1,  8}          }),
59
        new ScrambleState( new int[][] {{2, 1, 11,2, 2, 12,2,-1,  9}, {}                          , {0,-1,118}          }),   //10
60
        new ScrambleState( new int[][] {{2, 1, 12,2, 2,  9,2,-1, 10}, {}                          , {2, 1, 77}          }),
61
        new ScrambleState( new int[][] {{2, 1,  9,2, 2, 10,2,-1, 11}, {}                          , {2, 1, 13,2, 2,143} }),
62
        new ScrambleState( new int[][] {{2, 1, 14,2, 2, 15,2,-1, 16}, {2, 1, 57,2,-1, 58}         , {2, 1,143,2,-1, 12} }),
63
        new ScrambleState( new int[][] {{2, 1, 15,2, 2, 16,2,-1, 13}, {}                          , {2, 1, 41}          }),
64
        new ScrambleState( new int[][] {{2, 1, 16,2, 2, 13,2,-1, 14}, {}                          , {0, 1, 82}          }),
65
        new ScrambleState( new int[][] {{2, 1, 13,2, 2, 14,2,-1, 15}, {2, 1, 17,2,-1, 18}         , {0, 1,111,0,-1,115} }),
66
        new ScrambleState( new int[][] {{}                          , {2, 2, 18,2,-1, 16}         , {0,-1,139}          }),
67
        new ScrambleState( new int[][] {{2, 1, 19,2,-1, 20}         , {2, 1, 16,2, 2, 17}         , {2, 1,142}          }),
68
        new ScrambleState( new int[][] {{2, 2, 20,2,-1, 18}         , {}                          , {2, 1, 39,2, 2,140} }),
69
        new ScrambleState( new int[][] {{2, 1, 18,2, 2, 19}         , {2, 1, 21}                  , {}                  }),   //20
70
        new ScrambleState( new int[][] {{}                          , {2,-1, 20}                  , {0,-1, 22}          }),
71
        new ScrambleState( new int[][] {{2, 2, 23,2,-1, 24}         , {}                          , {0, 1, 21}          }),
72
        new ScrambleState( new int[][] {{2, 1, 24,2, 2, 22}         , {}                          , {2, 1, 92}          }),
73
        new ScrambleState( new int[][] {{2, 1, 22,2,-1, 23}         , {}                          , {0, 1, 25}          }),
74
        new ScrambleState( new int[][] {{2, 1, 26,2, 2, 27}         , {}                          , {0,-1, 24}          }),
75
        new ScrambleState( new int[][] {{2, 1, 27,2,-1, 25}         , {2, 1, 74}                  , {}                  }),
76
        new ScrambleState( new int[][] {{2, 2, 25,2,-1, 26}         , {}                          , {2, 1, 28,2, 2,124} }),
77
        new ScrambleState( new int[][] {{2, 1, 29,2, 2, 30,2,-1, 31}, {2,-1,142}                  , {2, 1,124,2,-1, 27} }),
78
        new ScrambleState( new int[][] {{2, 1, 30,2, 2, 31,2,-1, 28}, {}                          , {2, 1,141}          }),
79
        new ScrambleState( new int[][] {{2, 1, 31,2, 2, 28,2,-1, 29}, {}                          , {0, 1,130}          }),   //30
80
        new ScrambleState( new int[][] {{2, 1, 28,2, 2, 29,2,-1, 30}, {2, 1, 32,2,-1, 33}         , {0, 1, 89,0,-1, 90} }),
81
        new ScrambleState( new int[][] {{}                          , {2, 2, 33,2,-1, 31}         , {0,-1,137}          }),
82
        new ScrambleState( new int[][] {{2, 1, 34}                  , {2, 1, 31,2, 2, 32}         , {}                  }),
83
        new ScrambleState( new int[][] {{2,-1, 33}                  , {}                          , {2, 1, 35}          }),
84
        new ScrambleState( new int[][] {{}                          , {2,-1, 36}                  , {2,-1, 34}          }),
85
        new ScrambleState( new int[][] {{}                          , {2, 1, 35}                  , {2,-1, 37}          }),
86
        new ScrambleState( new int[][] {{}                          , {2, 1, 38,2, 2, 93}         , {2, 1, 36}          }),
87
        new ScrambleState( new int[][] {{2, 1, 39}                  , {2, 1, 93,2,-1, 37}         , {}                  }),
88
        new ScrambleState( new int[][] {{2,-1, 38}                  , {2, 1, 40,2,-1, 64}         , {2, 1,140,2,-1, 19} }),
89
        new ScrambleState( new int[][] {{2, 1, 41,2,-1, 42}         , {2, 2, 64,2,-1, 39}         , {}                  }),   //40
90
        new ScrambleState( new int[][] {{2, 2, 42,2,-1, 40}         , {}                          , {2,-1, 14}          }),
91
        new ScrambleState( new int[][] {{2, 1, 40,2, 2, 41}         , {}                          , {0, 1, 43,0, 2,128} }),
92
        new ScrambleState( new int[][] {{2, 1, 44,2,-1, 45}         , {2, 1,114,2, 2,113,2,-1, 86}, {0, 1,128,0,-1, 42} }),
93
        new ScrambleState( new int[][] {{2, 2, 45,2,-1, 43}         , {2, 1, 48,2,-1,108}         , {2,-1, 81}          }),
94
        new ScrambleState( new int[][] {{2, 1, 43,2, 2, 44}         , {}                          , {0, 1, 46}          }),
95
        new ScrambleState( new int[][] {{}                          , {2, 1, 47}                  , {0,-1, 45}          }),
96
        new ScrambleState( new int[][] {{}                          , {2,-1, 46}                  , {0, 2,  2,0,-1,  3} }),
97
        new ScrambleState( new int[][] {{2,-1, 49}                  , {2, 2,108,2,-1, 44}         , {}                  }),
98
        new ScrambleState( new int[][] {{2, 1, 48}                  , {}                          , {0, 1, 50}          }),
99
        new ScrambleState( new int[][] {{}                          , {2, 1, 51,2, 2, 52}         , {0,-1, 49}          }),   //50
100
        new ScrambleState( new int[][] {{}                          , {2, 1, 52,2,-1, 50}         , {0,-1,  5}          }),
101
        new ScrambleState( new int[][] {{}                          , {2, 2, 50,2,-1, 51}         , {2,-1, 53}          }),
102
        new ScrambleState( new int[][] {{}                          , {2, 1, 54,2, 2, 55}         , {2, 1, 52}          }),
103
        new ScrambleState( new int[][] {{}                          , {2, 1, 55,2,-1, 53}         , {0,-1,104}          }),
104
        new ScrambleState( new int[][] {{}                          , {2, 2, 53,2,-1, 54}         , {0, 2, 56,0,-1, 65} }),
105
        new ScrambleState( new int[][] {{2, 1, 57}                  , {}                          , {0, 1, 65,0, 2, 55} }),
106
        new ScrambleState( new int[][] {{2,-1, 56}                  , {2, 2, 58,2,-1, 13}         , {}                  }),
107
        new ScrambleState( new int[][] {{}                          , {2, 1, 13,2, 2, 57}         , {2,-1, 59}          }),
108
        new ScrambleState( new int[][] {{2, 1, 60}                  , {}                          , {2, 1, 58}          }),
109
        new ScrambleState( new int[][] {{2,-1, 59}                  , {}                          , {2, 1, 61}          }),   //60
110
        new ScrambleState( new int[][] {{2,-1, 62}                  , {}                          , {2,-1, 60}          }),
111
        new ScrambleState( new int[][] {{2, 1, 61}                  , {2,-1, 63}                  , {}                  }),
112
        new ScrambleState( new int[][] {{}                          , {2, 1, 62}                  , {2, 1, 64}          }),
113
        new ScrambleState( new int[][] {{}                          , {2, 1, 39,2, 2, 40}         , {2,-1, 63}          }),
114
        new ScrambleState( new int[][] {{2, 1, 66,2,-1, 67}         , {2, 1, 78,2, 2, 79,2,-1, 80}, {0, 1, 55,0,-1, 56} }),
115
        new ScrambleState( new int[][] {{2, 2, 67,2,-1, 65}         , {2,-1,107}                  , {}                  }),
116
        new ScrambleState( new int[][] {{2, 1, 65,2, 2, 66}         , {}                          , {0, 1, 68}          }),
117
        new ScrambleState( new int[][] {{}                          , {2, 1, 69}                  , {0,-1, 67}          }),
118
        new ScrambleState( new int[][] {{}                          , {2,-1, 68}                  , {0,-1, 70}          }),
119
        new ScrambleState( new int[][] {{}                          , {2,-1, 71}                  , {0, 1, 69}          }),   //70
120
        new ScrambleState( new int[][] {{2,-1, 72}                  , {2, 1, 70}                  , {}                  }),
121
        new ScrambleState( new int[][] {{2, 1, 71}                  , {}                          , {0,-1, 73}          }),
122
        new ScrambleState( new int[][] {{2, 1, 74,2, 2, 75}         , {}                          , {0, 1, 72}          }),
123
        new ScrambleState( new int[][] {{2, 1, 75,2,-1, 73}         , {2,-1, 26}                  , {0, 1, 83,0,-1,138} }),
124
        new ScrambleState( new int[][] {{2, 2, 73,2,-1, 74}         , {2, 1, 76,2,-1, 77}         , {}                  }),
125
        new ScrambleState( new int[][] {{}                          , {2, 2, 77,2,-1, 75}         , {0, 1, 78}          }),
126
        new ScrambleState( new int[][] {{}                          , {2, 1, 75,2, 2, 76}         , {2,-1, 11}          }),
127
        new ScrambleState( new int[][] {{}                          , {2, 1, 79,2, 2, 80,2,-1, 65}, {0,-1, 76}          }),
128
        new ScrambleState( new int[][] {{}                          , {2, 1, 80,2, 2, 65,2,-1, 78}, {2,-1,110}          }),
129
        new ScrambleState( new int[][] {{2, 1, 81,2,-1, 82}         , {2, 1, 65,2, 2, 78,2,-1, 79}, {2, 1,  6,2,-1,  7} }),   //80
130
        new ScrambleState( new int[][] {{2, 2, 82,2,-1, 80}         , {}                          , {2, 1, 44}          }),
131
        new ScrambleState( new int[][] {{2, 1, 80,2, 2, 81}         , {2, 1, 83,2,-1, 84}         , {0,-1, 15}          }),
132
        new ScrambleState( new int[][] {{}                          , {2, 2, 84,2,-1, 82}         , {0, 2,138,0,-1, 74} }),
133
        new ScrambleState( new int[][] {{2, 1, 85}                  , {2, 1, 82,2, 2, 83}         , {}                  }),
134
        new ScrambleState( new int[][] {{2,-1, 84}                  , {}                          , {2, 1, 86,2, 2,119} }),
135
        new ScrambleState( new int[][] {{2, 1, 87,2,-1, 88}         , {2, 1, 43,2, 2,114,2,-1,113}, {2, 1,119,2,-1, 85} }),
136
        new ScrambleState( new int[][] {{2, 2, 88,2,-1, 86}         , {}                          , {2, 1, 94}          }),
137
        new ScrambleState( new int[][] {{2, 1, 86,2, 2, 87}         , {2, 1, 89}                  , {}                  }),
138
        new ScrambleState( new int[][] {{}                          , {2,-1, 88}                  , {0, 2, 90,0,-1, 31} }),
139
        new ScrambleState( new int[][] {{2, 1, 91,2, 2, 92}         , {}                          , {0, 1, 31,0, 2, 89} }),   //90
140
        new ScrambleState( new int[][] {{2, 1, 92,2,-1, 90}         , {}                          , {0, 1, 93}          }),
141
        new ScrambleState( new int[][] {{2, 2, 90,2,-1, 91}         , {}                          , {2,-1, 23}          }),
142
        new ScrambleState( new int[][] {{}                          , {2, 2, 37,2,-1, 38}         , {0,-1, 91}          }),
143
        new ScrambleState( new int[][] {{}                          , {2,-1, 95}                  , {2,-1, 87}          }),
144
        new ScrambleState( new int[][] {{}                          , {2, 1, 94}                  , {2,-1, 96}          }),
145
        new ScrambleState( new int[][] {{}                          , {2, 1, 97}                  , {2, 1, 95}          }),
146
        new ScrambleState( new int[][] {{2, 1, 98}                  , {2,-1, 96}                  , {}                  }),
147
        new ScrambleState( new int[][] {{2,-1, 97}                  , {}                          , {2,-1, 99}          }),
148
        new ScrambleState( new int[][] {{2, 2,100,2,-1,101}         , {}                          , {2, 1, 98}          }),
149
        new ScrambleState( new int[][] {{2, 1,101,2, 2, 99}         , {2, 1,111,2,-1,112}         , {}                  }),   //100
150
        new ScrambleState( new int[][] {{2, 1, 99,2,-1,100}         , {2, 1,102}                  , {2, 1,108,2,-1,109} }),
151
        new ScrambleState( new int[][] {{2, 1,103,2,-1,104}         , {2,-1,101}                  , {}                  }),
152
        new ScrambleState( new int[][] {{2, 2,104,2,-1,102}         , {}                          , {2,-1,105}          }),
153
        new ScrambleState( new int[][] {{2, 1,102,2, 2,103}         , {}                          , {0, 1, 54}          }),
154
        new ScrambleState( new int[][] {{2,-1,106}                  , {}                          , {2, 1,103}          }),
155
        new ScrambleState( new int[][] {{2, 1,105}                  , {}                          , {2, 1,107}          }),
156
        new ScrambleState( new int[][] {{}                          , {2, 1, 66}                  , {2,-1,106}          }),
157
        new ScrambleState( new int[][] {{}                          , {2, 1, 44,2, 2, 48}         , {2, 2,109,2,-1,101} }),
158
        new ScrambleState( new int[][] {{2,-1,110}                  , {}                          , {2, 1,101,2, 2,108} }),
159
        new ScrambleState( new int[][] {{2, 1,109}                  , {}                          , {2, 1, 79}          }),   //110
160
        new ScrambleState( new int[][] {{}                          , {2, 2,112,2,-1,100}         , {0, 2,115,0,-1, 16} }),
161
        new ScrambleState( new int[][] {{}                          , {2, 1,100,2, 2,111}         , {2, 1,113}          }),
162
        new ScrambleState( new int[][] {{}                          , {2, 1, 86,2, 2, 43,2,-1,114}, {2,-1,112}          }),
163
        new ScrambleState( new int[][] {{}                          , {2, 1,113,2, 2, 86,2,-1, 43}, {0,-1,  0}          }),
164
        new ScrambleState( new int[][] {{2, 2,116}                  , {}                          , {0, 1, 16,0, 2,111} }),
165
        new ScrambleState( new int[][] {{2, 2,115}                  , {}                          , {2,-1,117}          }),
166
        new ScrambleState( new int[][] {{2, 1,118}                  , {}                          , {2, 1,116}          }),
167
        new ScrambleState( new int[][] {{2,-1,117}                  , {}                          , {0, 1, 10}          }),
168
        new ScrambleState( new int[][] {{}                          , {2, 1,120,2, 2,121,2,-1,122}, {2, 2, 85,2,-1, 86} }),
169
        new ScrambleState( new int[][] {{}                          , {2, 1,121,2, 2,122,2,-1,119}, {2,-1,129}          }),   //120
170
        new ScrambleState( new int[][] {{}                          , {2, 1,122,2, 2,119,2,-1,120}, {0, 1,125}          }),
171
        new ScrambleState( new int[][] {{}                          , {2, 1,119,2, 2,120,2,-1,121}, {0,-1,123}          }),
172
        new ScrambleState( new int[][] {{}                          , {2, 2,124}                  , {0, 1,122}          }),
173
        new ScrambleState( new int[][] {{}                          , {2, 2,123}                  , {2, 2, 27,2,-1, 28} }),
174
        new ScrambleState( new int[][] {{}                          , {2, 1,126}                  , {0,-1,121}          }),
175
        new ScrambleState( new int[][] {{}                          , {2,-1,125}                  , {2,-1,127}          }),
176
        new ScrambleState( new int[][] {{}                          , {2, 2,128}                  , {2, 1,126}          }),
177
        new ScrambleState( new int[][] {{}                          , {2, 2,127}                  , {0, 2, 42,0,-1, 43} }),
178
        new ScrambleState( new int[][] {{2, 2,130,2,-1,131}         , {}                          , {2, 1,120}          }),
179
        new ScrambleState( new int[][] {{2, 1,131,2, 2,129}         , {}                          , {0,-1, 30}          }),   //130
180
        new ScrambleState( new int[][] {{2, 1,129,2,-1,130}         , {2, 1,  3,2, 2,132}         , {}                  }),
181
        new ScrambleState( new int[][] {{}                          , {2, 2,131,2,-1,  3}         , {0,-1,133}          }),
182
        new ScrambleState( new int[][] {{}                          , {2,-1,134}                  , {0, 1,132}          }),
183
        new ScrambleState( new int[][] {{2,-1,135}                  , {2, 1,133}                  , {}                  }),
184
        new ScrambleState( new int[][] {{2, 1,134}                  , {}                          , {0,-1,136}          }),
185
        new ScrambleState( new int[][] {{2, 1,137}                  , {}                          , {0, 1,135}          }),
186
        new ScrambleState( new int[][] {{2,-1,136}                  , {}                          , {0, 1, 32}          }),
187
        new ScrambleState( new int[][] {{2, 1,139}                  , {}                          , {0, 1, 74,0, 2, 83} }),
188
        new ScrambleState( new int[][] {{2,-1,138}                  , {}                          , {0, 1, 17}          }),
189
        new ScrambleState( new int[][] {{}                          , {2, 1,141}                  , {2, 2, 19,2,-1, 39} }),   //140
190
        new ScrambleState( new int[][] {{}                          , {2,-1,140}                  , {2,-1, 29}          }),
191
        new ScrambleState( new int[][] {{}                          , {2, 1, 28}                  , {2,-1, 18}          }),
192
        new ScrambleState( new int[][] {{}                          , {2, 1,  1}                  , {2, 2, 12,2,-1, 13} })
193
        };
194
      }
39 195

  
40
    mStates = new ScrambleState[]
41
     {
42
     new ScrambleState( new int[][] {{2, 1,  1,2,-1,  2}         , {2, 2,142,2,-1, 28}         , {0, 1,114}          }),   //0
43
     new ScrambleState( new int[][] {{2, 2,  2}                  , {2,-1,143}                  , {}                  }),
44
     new ScrambleState( new int[][] {{2, 2,  1}                  , {}                          , {0, 1,  3,0, 2, 47} }),
45
     new ScrambleState( new int[][] {{2, 1,  4}                  , {2, 1,132,2,-1,131}         , {0, 1, 47,0,-1,  2} }),
46
     new ScrambleState( new int[][] {{2,-1,  3}                  , {2, 1,  5,2,-1,  6}         , {}                  }),
47
     new ScrambleState( new int[][] {{}                          , {2, 2,  6,2,-1,  4}         , {0, 1, 51}          }),
48
     new ScrambleState( new int[][] {{}                          , {2, 1,  4,2, 2,  5}         , {2, 2,  7,2,-1, 80} }),
49
     new ScrambleState( new int[][] {{2, 2,  8}                  , {}                          , {2, 1, 80,2, 2,  6} }),
50
     new ScrambleState( new int[][] {{2, 2,  7}                  , {}                          , {0,-1,  9}          }),
51
     new ScrambleState( new int[][] {{2, 1, 10,2, 2, 11,2,-1, 12}, {}                          , {0, 1,  8}          }),
52
     new ScrambleState( new int[][] {{2, 1, 11,2, 2, 12,2,-1,  9}, {}                          , {0,-1,118}          }),   //10
53
     new ScrambleState( new int[][] {{2, 1, 12,2, 2,  9,2,-1, 10}, {}                          , {2, 1, 77}          }),
54
     new ScrambleState( new int[][] {{2, 1,  9,2, 2, 10,2,-1, 11}, {}                          , {2, 1, 13,2, 2,143} }),
55
     new ScrambleState( new int[][] {{2, 1, 14,2, 2, 15,2,-1, 16}, {2, 1, 57,2,-1, 58}         , {2, 1,143,2,-1, 12} }),
56
     new ScrambleState( new int[][] {{2, 1, 15,2, 2, 16,2,-1, 13}, {}                          , {2, 1, 41}          }),
57
     new ScrambleState( new int[][] {{2, 1, 16,2, 2, 13,2,-1, 14}, {}                          , {0, 1, 82}          }),
58
     new ScrambleState( new int[][] {{2, 1, 13,2, 2, 14,2,-1, 15}, {2, 1, 17,2,-1, 18}         , {0, 1,111,0,-1,115} }),
59
     new ScrambleState( new int[][] {{}                          , {2, 2, 18,2,-1, 16}         , {0,-1,139}          }),
60
     new ScrambleState( new int[][] {{2, 1, 19,2,-1, 20}         , {2, 1, 16,2, 2, 17}         , {2, 1,142}          }),
61
     new ScrambleState( new int[][] {{2, 2, 20,2,-1, 18}         , {}                          , {2, 1, 39,2, 2,140} }),
62
     new ScrambleState( new int[][] {{2, 1, 18,2, 2, 19}         , {2, 1, 21}                  , {}                  }),   //20
63
     new ScrambleState( new int[][] {{}                          , {2,-1, 20}                  , {0,-1, 22}          }),
64
     new ScrambleState( new int[][] {{2, 2, 23,2,-1, 24}         , {}                          , {0, 1, 21}          }),
65
     new ScrambleState( new int[][] {{2, 1, 24,2, 2, 22}         , {}                          , {2, 1, 92}          }),
66
     new ScrambleState( new int[][] {{2, 1, 22,2,-1, 23}         , {}                          , {0, 1, 25}          }),
67
     new ScrambleState( new int[][] {{2, 1, 26,2, 2, 27}         , {}                          , {0,-1, 24}          }),
68
     new ScrambleState( new int[][] {{2, 1, 27,2,-1, 25}         , {2, 1, 74}                  , {}                  }),
69
     new ScrambleState( new int[][] {{2, 2, 25,2,-1, 26}         , {}                          , {2, 1, 28,2, 2,124} }),
70
     new ScrambleState( new int[][] {{2, 1, 29,2, 2, 30,2,-1, 31}, {2,-1,142}                  , {2, 1,124,2,-1, 27} }),
71
     new ScrambleState( new int[][] {{2, 1, 30,2, 2, 31,2,-1, 28}, {}                          , {2, 1,141}          }),
72
     new ScrambleState( new int[][] {{2, 1, 31,2, 2, 28,2,-1, 29}, {}                          , {0, 1,130}          }),   //30
73
     new ScrambleState( new int[][] {{2, 1, 28,2, 2, 29,2,-1, 30}, {2, 1, 32,2,-1, 33}         , {0, 1, 89,0,-1, 90} }),
74
     new ScrambleState( new int[][] {{}                          , {2, 2, 33,2,-1, 31}         , {0,-1,137}          }),
75
     new ScrambleState( new int[][] {{2, 1, 34}                  , {2, 1, 31,2, 2, 32}         , {}                  }),
76
     new ScrambleState( new int[][] {{2,-1, 33}                  , {}                          , {2, 1, 35}          }),
77
     new ScrambleState( new int[][] {{}                          , {2,-1, 36}                  , {2,-1, 34}          }),
78
     new ScrambleState( new int[][] {{}                          , {2, 1, 35}                  , {2,-1, 37}          }),
79
     new ScrambleState( new int[][] {{}                          , {2, 1, 38,2, 2, 93}         , {2, 1, 36}          }),
80
     new ScrambleState( new int[][] {{2, 1, 39}                  , {2, 1, 93,2,-1, 37}         , {}                  }),
81
     new ScrambleState( new int[][] {{2,-1, 38}                  , {2, 1, 40,2,-1, 64}         , {2, 1,140,2,-1, 19} }),
82
     new ScrambleState( new int[][] {{2, 1, 41,2,-1, 42}         , {2, 2, 64,2,-1, 39}         , {}                  }),   //40
83
     new ScrambleState( new int[][] {{2, 2, 42,2,-1, 40}         , {}                          , {2,-1, 14}          }),
84
     new ScrambleState( new int[][] {{2, 1, 40,2, 2, 41}         , {}                          , {0, 1, 43,0, 2,128} }),
85
     new ScrambleState( new int[][] {{2, 1, 44,2,-1, 45}         , {2, 1,114,2, 2,113,2,-1, 86}, {0, 1,128,0,-1, 42} }),
86
     new ScrambleState( new int[][] {{2, 2, 45,2,-1, 43}         , {2, 1, 48,2,-1,108}         , {2,-1, 81}          }),
87
     new ScrambleState( new int[][] {{2, 1, 43,2, 2, 44}         , {}                          , {0, 1, 46}          }),
88
     new ScrambleState( new int[][] {{}                          , {2, 1, 47}                  , {0,-1, 45}          }),
89
     new ScrambleState( new int[][] {{}                          , {2,-1, 46}                  , {0, 2,  2,0,-1,  3} }),
90
     new ScrambleState( new int[][] {{2,-1, 49}                  , {2, 2,108,2,-1, 44}         , {}                  }),
91
     new ScrambleState( new int[][] {{2, 1, 48}                  , {}                          , {0, 1, 50}          }),
92
     new ScrambleState( new int[][] {{}                          , {2, 1, 51,2, 2, 52}         , {0,-1, 49}          }),   //50
93
     new ScrambleState( new int[][] {{}                          , {2, 1, 52,2,-1, 50}         , {0,-1,  5}          }),
94
     new ScrambleState( new int[][] {{}                          , {2, 2, 50,2,-1, 51}         , {2,-1, 53}          }),
95
     new ScrambleState( new int[][] {{}                          , {2, 1, 54,2, 2, 55}         , {2, 1, 52}          }),
96
     new ScrambleState( new int[][] {{}                          , {2, 1, 55,2,-1, 53}         , {0,-1,104}          }),
97
     new ScrambleState( new int[][] {{}                          , {2, 2, 53,2,-1, 54}         , {0, 2, 56,0,-1, 65} }),
98
     new ScrambleState( new int[][] {{2, 1, 57}                  , {}                          , {0, 1, 65,0, 2, 55} }),
99
     new ScrambleState( new int[][] {{2,-1, 56}                  , {2, 2, 58,2,-1, 13}         , {}                  }),
100
     new ScrambleState( new int[][] {{}                          , {2, 1, 13,2, 2, 57}         , {2,-1, 59}          }),
101
     new ScrambleState( new int[][] {{2, 1, 60}                  , {}                          , {2, 1, 58}          }),
102
     new ScrambleState( new int[][] {{2,-1, 59}                  , {}                          , {2, 1, 61}          }),   //60
103
     new ScrambleState( new int[][] {{2,-1, 62}                  , {}                          , {2,-1, 60}          }),
104
     new ScrambleState( new int[][] {{2, 1, 61}                  , {2,-1, 63}                  , {}                  }),
105
     new ScrambleState( new int[][] {{}                          , {2, 1, 62}                  , {2, 1, 64}          }),
106
     new ScrambleState( new int[][] {{}                          , {2, 1, 39,2, 2, 40}         , {2,-1, 63}          }),
107
     new ScrambleState( new int[][] {{2, 1, 66,2,-1, 67}         , {2, 1, 78,2, 2, 79,2,-1, 80}, {0, 1, 55,0,-1, 56} }),
108
     new ScrambleState( new int[][] {{2, 2, 67,2,-1, 65}         , {2,-1,107}                  , {}                  }),
109
     new ScrambleState( new int[][] {{2, 1, 65,2, 2, 66}         , {}                          , {0, 1, 68}          }),
110
     new ScrambleState( new int[][] {{}                          , {2, 1, 69}                  , {0,-1, 67}          }),
111
     new ScrambleState( new int[][] {{}                          , {2,-1, 68}                  , {0,-1, 70}          }),
112
     new ScrambleState( new int[][] {{}                          , {2,-1, 71}                  , {0, 1, 69}          }),   //70
113
     new ScrambleState( new int[][] {{2,-1, 72}                  , {2, 1, 70}                  , {}                  }),
114
     new ScrambleState( new int[][] {{2, 1, 71}                  , {}                          , {0,-1, 73}          }),
115
     new ScrambleState( new int[][] {{2, 1, 74,2, 2, 75}         , {}                          , {0, 1, 72}          }),
116
     new ScrambleState( new int[][] {{2, 1, 75,2,-1, 73}         , {2,-1, 26}                  , {0, 1, 83,0,-1,138} }),
117
     new ScrambleState( new int[][] {{2, 2, 73,2,-1, 74}         , {2, 1, 76,2,-1, 77}         , {}                  }),
118
     new ScrambleState( new int[][] {{}                          , {2, 2, 77,2,-1, 75}         , {0, 1, 78}          }),
119
     new ScrambleState( new int[][] {{}                          , {2, 1, 75,2, 2, 76}         , {2,-1, 11}          }),
120
     new ScrambleState( new int[][] {{}                          , {2, 1, 79,2, 2, 80,2,-1, 65}, {0,-1, 76}          }),
121
     new ScrambleState( new int[][] {{}                          , {2, 1, 80,2, 2, 65,2,-1, 78}, {2,-1,110}          }),
122
     new ScrambleState( new int[][] {{2, 1, 81,2,-1, 82}         , {2, 1, 65,2, 2, 78,2,-1, 79}, {2, 1,  6,2,-1,  7} }),   //80
123
     new ScrambleState( new int[][] {{2, 2, 82,2,-1, 80}         , {}                          , {2, 1, 44}          }),
124
     new ScrambleState( new int[][] {{2, 1, 80,2, 2, 81}         , {2, 1, 83,2,-1, 84}         , {0,-1, 15}          }),
125
     new ScrambleState( new int[][] {{}                          , {2, 2, 84,2,-1, 82}         , {0, 2,138,0,-1, 74} }),
126
     new ScrambleState( new int[][] {{2, 1, 85}                  , {2, 1, 82,2, 2, 83}         , {}                  }),
127
     new ScrambleState( new int[][] {{2,-1, 84}                  , {}                          , {2, 1, 86,2, 2,119} }),
128
     new ScrambleState( new int[][] {{2, 1, 87,2,-1, 88}         , {2, 1, 43,2, 2,114,2,-1,113}, {2, 1,119,2,-1, 85} }),
129
     new ScrambleState( new int[][] {{2, 2, 88,2,-1, 86}         , {}                          , {2, 1, 94}          }),
130
     new ScrambleState( new int[][] {{2, 1, 86,2, 2, 87}         , {2, 1, 89}                  , {}                  }),
131
     new ScrambleState( new int[][] {{}                          , {2,-1, 88}                  , {0, 2, 90,0,-1, 31} }),
132
     new ScrambleState( new int[][] {{2, 1, 91,2, 2, 92}         , {}                          , {0, 1, 31,0, 2, 89} }),   //90
133
     new ScrambleState( new int[][] {{2, 1, 92,2,-1, 90}         , {}                          , {0, 1, 93}          }),
134
     new ScrambleState( new int[][] {{2, 2, 90,2,-1, 91}         , {}                          , {2,-1, 23}          }),
135
     new ScrambleState( new int[][] {{}                          , {2, 2, 37,2,-1, 38}         , {0,-1, 91}          }),
136
     new ScrambleState( new int[][] {{}                          , {2,-1, 95}                  , {2,-1, 87}          }),
137
     new ScrambleState( new int[][] {{}                          , {2, 1, 94}                  , {2,-1, 96}          }),
138
     new ScrambleState( new int[][] {{}                          , {2, 1, 97}                  , {2, 1, 95}          }),
139
     new ScrambleState( new int[][] {{2, 1, 98}                  , {2,-1, 96}                  , {}                  }),
140
     new ScrambleState( new int[][] {{2,-1, 97}                  , {}                          , {2,-1, 99}          }),
141
     new ScrambleState( new int[][] {{2, 2,100,2,-1,101}         , {}                          , {2, 1, 98}          }),
142
     new ScrambleState( new int[][] {{2, 1,101,2, 2, 99}         , {2, 1,111,2,-1,112}         , {}                  }),   //100
143
     new ScrambleState( new int[][] {{2, 1, 99,2,-1,100}         , {2, 1,102}                  , {2, 1,108,2,-1,109} }),
144
     new ScrambleState( new int[][] {{2, 1,103,2,-1,104}         , {2,-1,101}                  , {}                  }),
145
     new ScrambleState( new int[][] {{2, 2,104,2,-1,102}         , {}                          , {2,-1,105}          }),
146
     new ScrambleState( new int[][] {{2, 1,102,2, 2,103}         , {}                          , {0, 1, 54}          }),
147
     new ScrambleState( new int[][] {{2,-1,106}                  , {}                          , {2, 1,103}          }),
148
     new ScrambleState( new int[][] {{2, 1,105}                  , {}                          , {2, 1,107}          }),
149
     new ScrambleState( new int[][] {{}                          , {2, 1, 66}                  , {2,-1,106}          }),
150
     new ScrambleState( new int[][] {{}                          , {2, 1, 44,2, 2, 48}         , {2, 2,109,2,-1,101} }),
151
     new ScrambleState( new int[][] {{2,-1,110}                  , {}                          , {2, 1,101,2, 2,108} }),
152
     new ScrambleState( new int[][] {{2, 1,109}                  , {}                          , {2, 1, 79}          }),   //110
153
     new ScrambleState( new int[][] {{}                          , {2, 2,112,2,-1,100}         , {0, 2,115,0,-1, 16} }),
154
     new ScrambleState( new int[][] {{}                          , {2, 1,100,2, 2,111}         , {2, 1,113}          }),
155
     new ScrambleState( new int[][] {{}                          , {2, 1, 86,2, 2, 43,2,-1,114}, {2,-1,112}          }),
156
     new ScrambleState( new int[][] {{}                          , {2, 1,113,2, 2, 86,2,-1, 43}, {0,-1,  0}          }),
157
     new ScrambleState( new int[][] {{2, 2,116}                  , {}                          , {0, 1, 16,0, 2,111} }),
158
     new ScrambleState( new int[][] {{2, 2,115}                  , {}                          , {2,-1,117}          }),
159
     new ScrambleState( new int[][] {{2, 1,118}                  , {}                          , {2, 1,116}          }),
160
     new ScrambleState( new int[][] {{2,-1,117}                  , {}                          , {0, 1, 10}          }),
161
     new ScrambleState( new int[][] {{}                          , {2, 1,120,2, 2,121,2,-1,122}, {2, 2, 85,2,-1, 86} }),
162
     new ScrambleState( new int[][] {{}                          , {2, 1,121,2, 2,122,2,-1,119}, {2,-1,129}          }),   //120
163
     new ScrambleState( new int[][] {{}                          , {2, 1,122,2, 2,119,2,-1,120}, {0, 1,125}          }),
164
     new ScrambleState( new int[][] {{}                          , {2, 1,119,2, 2,120,2,-1,121}, {0,-1,123}          }),
165
     new ScrambleState( new int[][] {{}                          , {2, 2,124}                  , {0, 1,122}          }),
166
     new ScrambleState( new int[][] {{}                          , {2, 2,123}                  , {2, 2, 27,2,-1, 28} }),
167
     new ScrambleState( new int[][] {{}                          , {2, 1,126}                  , {0,-1,121}          }),
168
     new ScrambleState( new int[][] {{}                          , {2,-1,125}                  , {2,-1,127}          }),
169
     new ScrambleState( new int[][] {{}                          , {2, 2,128}                  , {2, 1,126}          }),
170
     new ScrambleState( new int[][] {{}                          , {2, 2,127}                  , {0, 2, 42,0,-1, 43} }),
171
     new ScrambleState( new int[][] {{2, 2,130,2,-1,131}         , {}                          , {2, 1,120}          }),
172
     new ScrambleState( new int[][] {{2, 1,131,2, 2,129}         , {}                          , {0,-1, 30}          }),   //130
173
     new ScrambleState( new int[][] {{2, 1,129,2,-1,130}         , {2, 1,  3,2, 2,132}         , {}                  }),
174
     new ScrambleState( new int[][] {{}                          , {2, 2,131,2,-1,  3}         , {0,-1,133}          }),
175
     new ScrambleState( new int[][] {{}                          , {2,-1,134}                  , {0, 1,132}          }),
176
     new ScrambleState( new int[][] {{2,-1,135}                  , {2, 1,133}                  , {}                  }),
177
     new ScrambleState( new int[][] {{2, 1,134}                  , {}                          , {0,-1,136}          }),
178
     new ScrambleState( new int[][] {{2, 1,137}                  , {}                          , {0, 1,135}          }),
179
     new ScrambleState( new int[][] {{2,-1,136}                  , {}                          , {0, 1, 32}          }),
180
     new ScrambleState( new int[][] {{2, 1,139}                  , {}                          , {0, 1, 74,0, 2, 83} }),
181
     new ScrambleState( new int[][] {{2,-1,138}                  , {}                          , {0, 1, 17}          }),
182
     new ScrambleState( new int[][] {{}                          , {2, 1,141}                  , {2, 2, 19,2,-1, 39} }),   //140
183
     new ScrambleState( new int[][] {{}                          , {2,-1,140}                  , {2,-1, 29}          }),
184
     new ScrambleState( new int[][] {{}                          , {2, 1, 28}                  , {2,-1, 18}          }),
185
     new ScrambleState( new int[][] {{}                          , {2, 1,  1}                  , {2, 2, 12,2,-1, 13} })
186
     };
196
    return mStates;
187 197
    }
198

  
188 199
///////////////////////////////////////////////////////////////////////////////////////////////////
189 200

  
190 201
  float[][] getPositions()
src/main/java/org/distorted/objects/TwistyBandagedFused.java
36 36
                      DistortedEffects effects, int[][] moves, Resources res, int scrWidth)
37 37
    {
38 38
    super(size, quat, texture, mesh, effects, moves, ObjectList.BAN1, res, scrWidth);
39
    }
39 40

  
40
    int[] tmp = {0,-1,0, 0,1,0, 0,2,0, 2,-1,0, 2,1,0, 2,2,0};
41
///////////////////////////////////////////////////////////////////////////////////////////////////
41 42

  
42
    mStates = new ScrambleState[]
43
  ScrambleState[] getScrambleStates()
44
    {
45
    if( mStates==null )
43 46
      {
44
      new ScrambleState( new int[][] {tmp,tmp,tmp} )
45
      };
47
      int[] tmp = {0,-1,0, 0,1,0, 0,2,0, 2,-1,0, 2,1,0, 2,2,0};
48

  
49
      mStates = new ScrambleState[]
50
        {
51
        new ScrambleState( new int[][] {tmp,tmp,tmp} )
52
        };
53
      }
54

  
55
    return mStates;
46 56
    }
47 57

  
48 58
///////////////////////////////////////////////////////////////////////////////////////////////////
src/main/java/org/distorted/objects/TwistyCube.java
31 31
import org.distorted.library.type.Static4D;
32 32
import org.distorted.main.R;
33 33

  
34
import java.util.Random;
35

  
36 34
///////////////////////////////////////////////////////////////////////////////////////////////////
37 35

  
38 36
class TwistyCube extends TwistyObject
......
51 49
           COLOR_RED   , COLOR_ORANGE
52 50
         };
53 51

  
54
  private int mCurrState;
55
  private int mIndexExcluded;
56
  private final ScrambleState[] mStates;
57
  private int[][] mScrambleTable;
58
  private int[] mNumOccurences;
52
  private ScrambleState[] mStates;
59 53
  private Static4D[] mQuats;
60 54
  private int[] mBasicAngle;
61 55
  private ObjectSticker[] mStickers;
......
66 60
             DistortedEffects effects, int[][] moves, Resources res, int scrWidth)
67 61
    {
68 62
    super(size, size, quat, texture, mesh, effects, moves, ObjectList.CUBE, res, scrWidth);
63
    }
69 64

  
70
    int[][] m = new int[16][];
71
    for(int i=1; i<16; i++) m[i] = createEdges(size,i);
65
///////////////////////////////////////////////////////////////////////////////////////////////////
72 66

  
73
    mStates = new ScrambleState[]  // built so that all 3 axes must be present in every 4 consecutive moves
67
  ScrambleState[] getScrambleStates()
68
    {
69
    if( mStates==null )
74 70
      {
75
      new ScrambleState( new int[][] { m[ 1], m[ 2], m[ 3] } ),  // 0
76
      new ScrambleState( new int[][] {  null, m[ 4], m[ 5] } ),  // x
77
      new ScrambleState( new int[][] { m[ 6],  null, m[ 7] } ),  // y
78
      new ScrambleState( new int[][] { m[ 8], m[ 8],  null } ),  // z
79
      new ScrambleState( new int[][] { m[10],  null, m[ 7] } ),  // xy
80
      new ScrambleState( new int[][] { m[11], m[ 9],  null } ),  // xz
81
      new ScrambleState( new int[][] {  null, m[12], m[ 5] } ),  // yx
82
      new ScrambleState( new int[][] { m[ 8], m[13],  null } ),  // yz
83
      new ScrambleState( new int[][] {  null, m[ 4], m[14] } ),  // zx
84
      new ScrambleState( new int[][] { m[ 6],  null, m[15] } ),  // zy
85
      new ScrambleState( new int[][] {  null,  null, m[ 5] } ),  // xyx
86
      new ScrambleState( new int[][] {  null, m[ 4],  null } ),  // xzx
87
      new ScrambleState( new int[][] {  null,  null, m[ 7] } ),  // yxy
88
      new ScrambleState( new int[][] { m[ 6],  null,  null } ),  // yzy
89
      new ScrambleState( new int[][] {  null, m[ 9],  null } ),  // zxz
90
      new ScrambleState( new int[][] { m[ 8],  null,  null } ),  // zyz
91
      };
71
      int size = getNumLayers();
72
      int[][] m = new int[16][];
73
      for(int i=1; i<16; i++) m[i] = createEdges(size,i);
74

  
75
      mStates = new ScrambleState[]
76
        {
77
        new ScrambleState( new int[][] { m[ 1], m[ 2], m[ 3] } ),  // 0
78
        new ScrambleState( new int[][] {  null, m[ 4], m[ 5] } ),  // x
79
        new ScrambleState( new int[][] { m[ 6],  null, m[ 7] } ),  // y
80
        new ScrambleState( new int[][] { m[ 8], m[ 8],  null } ),  // z
81
        new ScrambleState( new int[][] { m[10],  null, m[ 7] } ),  // xy
82
        new ScrambleState( new int[][] { m[11], m[ 9],  null } ),  // xz
83
        new ScrambleState( new int[][] {  null, m[12], m[ 5] } ),  // yx
84
        new ScrambleState( new int[][] { m[ 8], m[13],  null } ),  // yz
85
        new ScrambleState( new int[][] {  null, m[ 4], m[14] } ),  // zx
86
        new ScrambleState( new int[][] { m[ 6],  null, m[15] } ),  // zy
87
        new ScrambleState( new int[][] {  null,  null, m[ 5] } ),  // xyx
88
        new ScrambleState( new int[][] {  null, m[ 4],  null } ),  // xzx
89
        new ScrambleState( new int[][] {  null,  null, m[ 7] } ),  // yxy
90
        new ScrambleState( new int[][] { m[ 6],  null,  null } ),  // yzy
91
        new ScrambleState( new int[][] {  null, m[ 9],  null } ),  // zxz
92
        new ScrambleState( new int[][] { m[ 8],  null,  null } ),  // zyz
93
        };
94
      }
95

  
96
    return mStates;
92 97
    }
93 98

  
94 99
///////////////////////////////////////////////////////////////////////////////////////////////////
......
368 373
    return mBasicAngle;
369 374
    }
370 375

  
371
///////////////////////////////////////////////////////////////////////////////////////////////////
372

  
373
  private void initializeScrambling()
374
    {
375
    int numLayers = getNumLayers();
376

  
377
    if( mScrambleTable ==null )
378
      {
379
      mScrambleTable = new int[NUM_AXIS][numLayers];
380
      }
381
    if( mNumOccurences ==null )
382
      {
383
      int max=0;
384

  
385
      for (ScrambleState mState : mStates)
386
        {
387
        int tmp = mState.getTotal(-1);
388
        if (max < tmp) max = tmp;
389
        }
390

  
391
      mNumOccurences = new int[max];
392
      }
393

  
394
    for(int i=0; i<NUM_AXIS; i++)
395
      for(int j=0; j<numLayers; j++) mScrambleTable[i][j] = 0;
396
    }
397

  
398
///////////////////////////////////////////////////////////////////////////////////////////////////
399

  
400
  public void randomizeNewScramble(int[][] scramble, Random rnd, int curr, int totalScrambles)
401
    {
402
    if( curr==0 )
403
      {
404
      mCurrState     = 0;
405
      mIndexExcluded =-1;
406
      initializeScrambling();
407
      }
408

  
409
    int[] info= mStates[mCurrState].getRandom(rnd, mIndexExcluded, mScrambleTable, mNumOccurences);
410

  
411
    scramble[curr][0] = info[0];
412
    scramble[curr][1] = info[1];
413
    scramble[curr][2] = info[2];
414

  
415
    mCurrState     = info[3];
416
    mIndexExcluded = info[0];
417
    }
418

  
419 376
///////////////////////////////////////////////////////////////////////////////////////////////////
420 377

  
421 378
  public int getObjectName(int numLayers)
src/main/java/org/distorted/objects/TwistyDiamond.java
31 31
import org.distorted.library.type.Static4D;
32 32
import org.distorted.main.R;
33 33

  
34
import java.util.Random;
35

  
36 34
///////////////////////////////////////////////////////////////////////////////////////////////////
37 35

  
38 36
public class TwistyDiamond extends TwistyObject
......
57 55
  private static final float DIST = 0.50f;
58 56
  private static final int FACES_PER_CUBIT =8;
59 57

  
60
  private int mCurrState;
61
  private int mIndexExcluded;
62
  private final ScrambleState[] mStates;
63
  private int[][] mScrambleTable;
64
  private int[] mNumOccurences;
58
  private ScrambleState[] mStates;
65 59
  private int[] mBasicAngle;
66 60
  private int[] mFaceMap;
67 61
  private Static4D[] mQuats;
......
74 68
                MeshSquare mesh, DistortedEffects effects, int[][] moves, Resources res, int scrWidth)
75 69
    {
76 70
    super(size, size, quat, texture, mesh, effects, moves, ObjectList.DIAM, res, scrWidth);
71
    }
77 72

  
78
    int[] tmp = new int[3*2*size];
73
///////////////////////////////////////////////////////////////////////////////////////////////////
79 74

  
80
    for(int i=0; i<2*size; i++)
75
  ScrambleState[] getScrambleStates()
76
    {
77
    if( mStates==null )
81 78
      {
82
      tmp[3*i  ] = (i<size) ?  i:i-size;
83
      tmp[3*i+1] = (i%2==0) ? -1:1;
84
      tmp[3*i+2] = 0;
79
      int size = getNumLayers();
80
      int[] tmp = new int[3*2*size];
81

  
82
      for(int i=0; i<2*size; i++)
83
        {
84
        tmp[3*i  ] = (i<size) ?  i:i-size;
85
        tmp[3*i+1] = (i%2==0) ? -1:1;
86
        tmp[3*i+2] = 0;
87
        }
88

  
89
      mStates = new ScrambleState[]
90
        {
91
        new ScrambleState( new int[][] {tmp,tmp,tmp,tmp} )
92
        };
85 93
      }
86 94

  
87
    mStates = new ScrambleState[]
88
      {
89
      new ScrambleState( new int[][] {tmp,tmp,tmp,tmp} )
90
      };
95
    return mStates;
91 96
    }
92 97

  
93 98
///////////////////////////////////////////////////////////////////////////////////////////////////
......
507 512
    return 1.5f;
508 513
    }
509 514

  
510
///////////////////////////////////////////////////////////////////////////////////////////////////
511

  
512
  private void initializeScrambling()
513
    {
514
    int numLayers = getNumLayers();
515

  
516
    if( mScrambleTable ==null )
517
      {
518
      mScrambleTable = new int[NUM_AXIS][numLayers];
519
      }
520
    if( mNumOccurences ==null )
521
      {
522
      int max=0;
523

  
524
      for (ScrambleState mState : mStates)
525
        {
526
        int tmp = mState.getTotal(-1);
527
        if (max < tmp) max = tmp;
528
        }
529

  
530
      mNumOccurences = new int[max];
531
      }
532

  
533
    for(int i=0; i<NUM_AXIS; i++)
534
      for(int j=0; j<numLayers; j++) mScrambleTable[i][j] = 0;
535
    }
536

  
537 515
///////////////////////////////////////////////////////////////////////////////////////////////////
538 516
// PUBLIC API
539 517

  
540
  public void randomizeNewScramble(int[][] scramble, Random rnd, int curr, int totalScrambles)
541
    {
542
    if( curr==0 )
543
      {
544
      mCurrState     = 0;
545
      mIndexExcluded =-1;
546
      initializeScrambling();
547
      }
548

  
549
    int[] info= mStates[mCurrState].getRandom(rnd, mIndexExcluded, mScrambleTable, mNumOccurences);
550

  
551
    scramble[curr][0] = info[0];
552
    scramble[curr][1] = info[1];
553
    scramble[curr][2] = info[2];
554

  
555
    mCurrState     = info[3];
556
    mIndexExcluded = info[0];
557
    }
558

  
559
///////////////////////////////////////////////////////////////////////////////////////////////////
560

  
561 518
  public Static3D[] getRotationAxis()
562 519
    {
563 520
    return ROT_AXIS;
src/main/java/org/distorted/objects/TwistyDino.java
30 30
import org.distorted.library.type.Static3D;
31 31
import org.distorted.library.type.Static4D;
32 32

  
33
import java.util.Random;
34

  
35 33
///////////////////////////////////////////////////////////////////////////////////////////////////
36 34

  
37 35
public abstract class TwistyDino extends TwistyObject
......
52 50
           COLOR_RED   , COLOR_ORANGE
53 51
         };
54 52

  
55
  private int mCurrState;
56
  private int mIndexExcluded;
57
  private int[][] mScrambleTable;
58
  private int[] mNumOccurences;
59 53
  private int[] mBasicAngle;
60 54
  private Static4D[] mQuats;
61 55
  private ObjectSticker[] mStickers;
......
229 223
    return 2.0f;
230 224
    }
231 225

  
232
///////////////////////////////////////////////////////////////////////////////////////////////////
233

  
234
  private void initializeScrambling()
235
    {
236
    int numLayers = getNumLayers();
237

  
238
    if( mScrambleTable ==null )
239
      {
240
      mScrambleTable = new int[NUM_AXIS][numLayers];
241
      }
242
    if( mNumOccurences ==null )
243
      {
244
      int max=0;
245

  
246
      for (ScrambleState mState : mStates)
247
        {
248
        int tmp = mState.getTotal(-1);
249
        if (max < tmp) max = tmp;
250
        }
251

  
252
      mNumOccurences = new int[max];
253
      }
254

  
255
    for(int i=0; i<NUM_AXIS; i++)
256
      for(int j=0; j<numLayers; j++) mScrambleTable[i][j] = 0;
257
    }
258

  
259 226
///////////////////////////////////////////////////////////////////////////////////////////////////
260 227
// PUBLIC API
261 228

  
262
  public void randomizeNewScramble(int[][] scramble, Random rnd, int curr, int totalScrambles)
263
    {
264
    if( curr==0 )
265
      {
266
      mCurrState     = 0;
267
      mIndexExcluded =-1;
268
      initializeScrambling();
269
      }
270

  
271
    int[] info= mStates[mCurrState].getRandom(rnd, mIndexExcluded, mScrambleTable, mNumOccurences);
272

  
273
    scramble[curr][0] = info[0];
274
    scramble[curr][1] = info[1];
275
    scramble[curr][2] = info[2];
276

  
277
    mCurrState     = info[3];
278
    mIndexExcluded = info[0];
279
    }
280

  
281
///////////////////////////////////////////////////////////////////////////////////////////////////
282

  
283 229
  public Static3D[] getRotationAxis()
284 230
    {
285 231
    return ROT_AXIS;
src/main/java/org/distorted/objects/TwistyDino4.java
40 40
              DistortedEffects effects, int[][] moves, Resources res, int scrWidth)
41 41
    {
42 42
    super(size, quat, texture, mesh, effects, moves, ObjectList.DIN4, res, scrWidth);
43
    }
44

  
45
///////////////////////////////////////////////////////////////////////////////////////////////////
43 46

  
44
    mStates = new ScrambleState[]
47
  ScrambleState[] getScrambleStates()
48
    {
49
    if( mStates==null )
45 50
      {
46
      new ScrambleState( new int[][] { {              2,1,2,2,-1,2},{0,1,3,0,-1,3              },{0,1,5,0,-1,5              },{              2,1,8,2,-1,8} } ),
47
      new ScrambleState( new int[][] { {                          },{0,1,3,0,-1,3              },{0,1,5,0,-1,5,             },{              2,1,8,2,-1,8} } ),
48
      new ScrambleState( new int[][] { {                          },{              2,1,4,2,-1,4},{              2,1,6,2,-1,6},{0,1,7,0,-1,7              } } ),
49
      new ScrambleState( new int[][] { {0,1,1,0,-1,1              },{                          },{              2,1,6,2,-1,6},{0,1,7,0,-1,7              } } ),
50
      new ScrambleState( new int[][] { {              2,1,2,2,-1,2},{                          },{0,1,5,0,-1,5,             },{              2,1,8,2,-1,8} } ),
51
      new ScrambleState( new int[][] { {0,1,1,0,-1,1              },{              2,1,4,2,-1,4},{                          },{0,1,7,0,-1,7              } } ),
52
      new ScrambleState( new int[][] { {              2,1,2,2,-1,2},{0,1,3,0,-1,3              },{                          },{              2,1,8,2,-1,8} } ),
53
      new ScrambleState( new int[][] { {              2,1,2,2,-1,2},{0,1,3,0,-1,3              },{0,1,5,0,-1,5,             },{                          } } ),
54
      new ScrambleState( new int[][] { {0,1,1,0,-1,1              },{              2,1,4,2,-1,4},{              2,1,6,2,-1,6},{                          } } ),
55
      };
51
      mStates = new ScrambleState[]
52
        {
53
        new ScrambleState( new int[][] { {              2,1,2,2,-1,2},{0,1,3,0,-1,3              },{0,1,5,0,-1,5              },{              2,1,8,2,-1,8} } ),
54
        new ScrambleState( new int[][] { {                          },{0,1,3,0,-1,3              },{0,1,5,0,-1,5,             },{              2,1,8,2,-1,8} } ),
55
        new ScrambleState( new int[][] { {                          },{              2,1,4,2,-1,4},{              2,1,6,2,-1,6},{0,1,7,0,-1,7              } } ),
56
        new ScrambleState( new int[][] { {0,1,1,0,-1,1              },{                          },{              2,1,6,2,-1,6},{0,1,7,0,-1,7              } } ),
57
        new ScrambleState( new int[][] { {              2,1,2,2,-1,2},{                          },{0,1,5,0,-1,5,             },{              2,1,8,2,-1,8} } ),
58
        new ScrambleState( new int[][] { {0,1,1,0,-1,1              },{              2,1,4,2,-1,4},{                          },{0,1,7,0,-1,7              } } ),
59
        new ScrambleState( new int[][] { {              2,1,2,2,-1,2},{0,1,3,0,-1,3              },{                          },{              2,1,8,2,-1,8} } ),
60
        new ScrambleState( new int[][] { {              2,1,2,2,-1,2},{0,1,3,0,-1,3              },{0,1,5,0,-1,5,             },{                          } } ),
61
        new ScrambleState( new int[][] { {0,1,1,0,-1,1              },{              2,1,4,2,-1,4},{              2,1,6,2,-1,6},{                          } } ),
62
        };
63
      }
64

  
65
    return mStates;
56 66
    }
57 67

  
58 68
///////////////////////////////////////////////////////////////////////////////////////////////////
src/main/java/org/distorted/objects/TwistyDino6.java
40 40
              DistortedEffects effects, int[][] moves, Resources res, int scrWidth)
41 41
    {
42 42
    super(size, quat, texture, mesh, effects, moves, ObjectList.DINO, res, scrWidth);
43
    }
44

  
45
///////////////////////////////////////////////////////////////////////////////////////////////////
43 46

  
44
    mStates = new ScrambleState[]
47
  ScrambleState[] getScrambleStates()
48
    {
49
    if( mStates==null )
45 50
      {
46
      new ScrambleState( new int[][] { {0,1,1,0,-1,1, 2,1,2,2,-1,2},{0,1,3,0,-1,3, 2,1,4,2,-1,4},{0,1,5,0,-1,5, 2,1,6,2,-1,6},{0,1,7,0,-1,7, 2,1,8,2,-1,8} } ),
47
      new ScrambleState( new int[][] { {                          },{0,1,3,0,-1,3              },{0,1,5,0,-1,5,             },{              2,1,8,2,-1,8} } ),
48
      new ScrambleState( new int[][] { {                          },{              2,1,4,2,-1,4},{              2,1,6,2,-1,6},{0,1,7,0,-1,7              } } ),
49
      new ScrambleState( new int[][] { {0,1,1,0,-1,1              },{                          },{              2,1,6,2,-1,6},{0,1,7,0,-1,7              } } ),
50
      new ScrambleState( new int[][] { {              2,1,2,2,-1,2},{                          },{0,1,5,0,-1,5,             },{              2,1,8,2,-1,8} } ),
51
      new ScrambleState( new int[][] { {0,1,1,0,-1,1              },{              2,1,4,2,-1,4},{                          },{0,1,7,0,-1,7              } } ),
52
      new ScrambleState( new int[][] { {              2,1,2,2,-1,2},{0,1,3,0,-1,3              },{                          },{              2,1,8,2,-1,8} } ),
53
      new ScrambleState( new int[][] { {              2,1,2,2,-1,2},{0,1,3,0,-1,3              },{0,1,5,0,-1,5,             },{                          } } ),
54
      new ScrambleState( new int[][] { {0,1,1,0,-1,1              },{              2,1,4,2,-1,4},{              2,1,6,2,-1,6},{                          } } ),
55
      };
51
      mStates = new ScrambleState[]
52
        {
53
        new ScrambleState( new int[][] { {0,1,1,0,-1,1, 2,1,2,2,-1,2},{0,1,3,0,-1,3, 2,1,4,2,-1,4},{0,1,5,0,-1,5, 2,1,6,2,-1,6},{0,1,7,0,-1,7, 2,1,8,2,-1,8} } ),
54
        new ScrambleState( new int[][] { {                          },{0,1,3,0,-1,3              },{0,1,5,0,-1,5,             },{              2,1,8,2,-1,8} } ),
55
        new ScrambleState( new int[][] { {                          },{              2,1,4,2,-1,4},{              2,1,6,2,-1,6},{0,1,7,0,-1,7              } } ),
56
        new ScrambleState( new int[][] { {0,1,1,0,-1,1              },{                          },{              2,1,6,2,-1,6},{0,1,7,0,-1,7              } } ),
57
        new ScrambleState( new int[][] { {              2,1,2,2,-1,2},{                          },{0,1,5,0,-1,5,             },{              2,1,8,2,-1,8} } ),
58
        new ScrambleState( new int[][] { {0,1,1,0,-1,1              },{              2,1,4,2,-1,4},{                          },{0,1,7,0,-1,7              } } ),
59
        new ScrambleState( new int[][] { {              2,1,2,2,-1,2},{0,1,3,0,-1,3              },{                          },{              2,1,8,2,-1,8} } ),
60
        new ScrambleState( new int[][] { {              2,1,2,2,-1,2},{0,1,3,0,-1,3              },{0,1,5,0,-1,5,             },{                          } } ),
61
        new ScrambleState( new int[][] { {0,1,1,0,-1,1              },{              2,1,4,2,-1,4},{              2,1,6,2,-1,6},{                          } } ),
62
        };
63
      }
64

  
65
    return mStates;
56 66
    }
57 67

  
58 68
///////////////////////////////////////////////////////////////////////////////////////////////////
src/main/java/org/distorted/objects/TwistyHelicopter.java
31 31
import org.distorted.library.type.Static4D;
32 32
import org.distorted.main.R;
33 33

  
34
import java.util.Random;
35

  
36 34
///////////////////////////////////////////////////////////////////////////////////////////////////
37 35

  
38 36
public class TwistyHelicopter extends TwistyObject
......
57 55

  
58 56
  private static final int FACES_PER_CUBIT =6;
59 57

  
60
  private int mCurrState;
61
  private int mIndexExcluded;
62
  private final ScrambleState[] mStates;
63
  private int[][] mScrambleTable;
64
  private int[] mNumOccurences;
58
  private ScrambleState[] mStates;
65 59
  private int[] mBasicAngle;
66 60
  private Static4D[] mQuats;
67 61
  private float[][] mCenters;
......
75 69
                   MeshSquare mesh, DistortedEffects effects, int[][] moves, Resources res, int scrWidth)
76 70
    {
77 71
    super(size, size, quat, texture, mesh, effects, moves, ObjectList.HELI, res, scrWidth);
72
    }
73

  
74
///////////////////////////////////////////////////////////////////////////////////////////////////
78 75

  
79
    mStates = new ScrambleState[]
76
  ScrambleState[] getScrambleStates()
77
    {
78
    if( mStates==null )
80 79
      {
81
      new ScrambleState( new int[][] { {0,1,1,2,1,2},{0,1,3,2,1,4},{0,1,5,2,1,6},{0,1,7,2,1,8},{0,1,9,2,1,10},{0,1,11,2,1,12} } ),
82
      new ScrambleState( new int[][] { {           },{           },{0,1,5      },{0,1,7      },{      2,1,10},{       2,1,12} } ),
83
      new ScrambleState( new int[][] { {           },{           },{      2,1,6},{      2,1,8},{0,1,9       },{0,1,11       } } ),
84
      new ScrambleState( new int[][] { {           },{           },{0,1,5      },{0,1,7      },{0,1,9       },{0,1,11       } } ),
85
      new ScrambleState( new int[][] { {           },{           },{      2,1,6},{      2,1,8},{      2,1,10},{       2,1,12} } ),
86
      new ScrambleState( new int[][] { {0,1,1      },{0,1,3      },{           },{           },{0,1,9       },{       2,1,12} } ),
87
      new ScrambleState( new int[][] { {      2,1,2},{      2,1,4},{           },{           },{      2,1,10},{0,1,11       } } ),
88
      new ScrambleState( new int[][] { {0,1,1      },{0,1,3      },{           },{           },{      2,1,10},{0,1,11       } } ),
89
      new ScrambleState( new int[][] { {      2,1,2},{      2,1,4},{           },{           },{0,1,9       },{       2,1,12} } ),
90
      new ScrambleState( new int[][] { {      2,1,2},{0,1,3      },{0,1,5      },{      2,1,8},{            },{             } } ),
91
      new ScrambleState( new int[][] { {0,1,1      },{      2,1,4},{      2,1,6},{0,1,7      },{            },{             } } ),
92
      new ScrambleState( new int[][] { {      2,1,2},{0,1,3      },{      2,1,6},{0,1,7      },{            },{             } } ),
93
      new ScrambleState( new int[][] { {0,1,1      },{      2,1,4},{0,1,5      },{      2,1,8},{            },{             } } ),
94
      };
80
      mStates = new ScrambleState[]
81
        {
82
        new ScrambleState( new int[][] { {0,1,1,2,1,2},{0,1,3,2,1,4},{0,1,5,2,1,6},{0,1,7,2,1,8},{0,1,9,2,1,10},{0,1,11,2,1,12} } ),
83
        new ScrambleState( new int[][] { {           },{           },{0,1,5      },{0,1,7      },{      2,1,10},{       2,1,12} } ),
84
        new ScrambleState( new int[][] { {           },{           },{      2,1,6},{      2,1,8},{0,1,9       },{0,1,11       } } ),
85
        new ScrambleState( new int[][] { {           },{           },{0,1,5      },{0,1,7      },{0,1,9       },{0,1,11       } } ),
86
        new ScrambleState( new int[][] { {           },{           },{      2,1,6},{      2,1,8},{      2,1,10},{       2,1,12} } ),
87
        new ScrambleState( new int[][] { {0,1,1      },{0,1,3      },{           },{           },{0,1,9       },{       2,1,12} } ),
88
        new ScrambleState( new int[][] { {      2,1,2},{      2,1,4},{           },{           },{      2,1,10},{0,1,11       } } ),
89
        new ScrambleState( new int[][] { {0,1,1      },{0,1,3      },{           },{           },{      2,1,10},{0,1,11       } } ),
90
        new ScrambleState( new int[][] { {      2,1,2},{      2,1,4},{           },{           },{0,1,9       },{       2,1,12} } ),
91
        new ScrambleState( new int[][] { {      2,1,2},{0,1,3      },{0,1,5      },{      2,1,8},{            },{             } } ),
92
        new ScrambleState( new int[][] { {0,1,1      },{      2,1,4},{      2,1,6},{0,1,7      },{            },{             } } ),
93
        new ScrambleState( new int[][] { {      2,1,2},{0,1,3      },{      2,1,6},{0,1,7      },{            },{             } } ),
94
        new ScrambleState( new int[][] { {0,1,1      },{      2,1,4},{0,1,5      },{      2,1,8},{            },{             } } ),
95
        };
96
      }
97

  
98
    return mStates;
95 99
    }
96 100

  
97 101
///////////////////////////////////////////////////////////////////////////////////////////////////
......
423 427
    return 2.0f;
424 428
    }
425 429

  
426
///////////////////////////////////////////////////////////////////////////////////////////////////
427

  
428
  private void initializeScrambling()
429
    {
430
    int numLayers = getNumLayers();
431

  
432
    if( mScrambleTable ==null )
433
      {
434
      mScrambleTable = new int[NUM_AXIS][numLayers];
435
      }
436
    if( mNumOccurences ==null )
437
      {
438
      int max=0;
439

  
440
      for (ScrambleState mState : mStates)
441
        {
442
        int tmp = mState.getTotal(-1);
443
        if (max < tmp) max = tmp;
444
        }
445

  
446
      mNumOccurences = new int[max];
447
      }
448

  
449
    for(int i=0; i<NUM_AXIS; i++)
450
      for(int j=0; j<numLayers; j++) mScrambleTable[i][j] = 0;
451
    }
452

  
453 430
///////////////////////////////////////////////////////////////////////////////////////////////////
454 431
// PUBLIC API
455 432

  
456
  public void randomizeNewScramble(int[][] scramble, Random rnd, int curr, int totalScrambles)
457
    {
458
    if( curr==0 )
459
      {
460
      mCurrState     = 0;
461
      mIndexExcluded =-1;
462
      initializeScrambling();
463
      }
464

  
465
    int[] info= mStates[mCurrState].getRandom(rnd, mIndexExcluded, mScrambleTable, mNumOccurences);
466

  
467
    scramble[curr][0] = info[0];
468
    scramble[curr][1] = info[1];
469
    scramble[curr][2] = info[2];
470

  
471
    mCurrState     = info[3];
472
    mIndexExcluded = info[0];
473
    }
474

  
475
///////////////////////////////////////////////////////////////////////////////////////////////////
476

  
477 433
  public Static3D[] getRotationAxis()
478 434
    {
479 435
    return ROT_AXIS;
src/main/java/org/distorted/objects/TwistyIvy.java
31 31
import org.distorted.library.type.Static4D;
32 32
import org.distorted.main.R;
33 33

  
34
import java.util.Random;
35

  
36 34
///////////////////////////////////////////////////////////////////////////////////////////////////
37 35

  
38 36
public class TwistyIvy extends TwistyObject
......
58 56
  private static final int  IVY_N = 8;
59 57
  private static final int FACES_PER_CUBIT =6;
60 58

  
61
  private int mCurrState;
62
  private int mIndexExcluded;
63
  private final ScrambleState[] mStates;
64
  private int[][] mScrambleTable;
65
  private int[] mNumOccurences;
59
  private ScrambleState[] mStates;
66 60
  private int[] mBasicAngle;
67 61
  private Static4D[] mQuats;
68 62
  private int[][] mFaceMap;
......
83 77
      };
84 78
    }
85 79

  
80
///////////////////////////////////////////////////////////////////////////////////////////////////
81

  
82
  ScrambleState[] getScrambleStates()
83
    {
84
    if( mStates==null )
85
      {
86
      int[] tmp = {0,-1,0, 0,1,0, 1,-1,0, 1,1,0 };
87

  
88
      mStates = new ScrambleState[]
89
        {
90
        new ScrambleState( new int[][] {tmp,tmp,tmp,tmp} )
91
        };
92
      }
93

  
94
    return mStates;
95
    }
96

  
86 97
///////////////////////////////////////////////////////////////////////////////////////////////////
87 98

  
88 99
  private void initializeQuats()
......
447 458
    return 2.0f;
448 459
    }
449 460

  
450
///////////////////////////////////////////////////////////////////////////////////////////////////
451

  
452
  private void initializeScrambling()
453
    {
454
    int numLayers = getNumLayers();
455

  
456
    if( mScrambleTable ==null )
457
      {
458
      mScrambleTable = new int[NUM_AXIS][numLayers];
459
      }
460
    if( mNumOccurences ==null )
461
      {
462
      int max=0;
463

  
464
      for (ScrambleState mState : mStates)
465
        {
466
        int tmp = mState.getTotal(-1);
467
        if (max < tmp) max = tmp;
468
        }
469

  
470
      mNumOccurences = new int[max];
471
      }
472

  
473
    for(int i=0; i<NUM_AXIS; i++)
474
      for(int j=0; j<numLayers; j++) mScrambleTable[i][j] = 0;
475
    }
476

  
477 461
///////////////////////////////////////////////////////////////////////////////////////////////////
478 462
// PUBLIC API
479 463

  
480
  public void randomizeNewScramble(int[][] scramble, Random rnd, int curr, int totalScrambles)
481
    {
482
    if( curr==0 )
483
      {
484
      mCurrState     = 0;
485
      mIndexExcluded =-1;
486
      initializeScrambling();
487
      }
488

  
489
    int[] info= mStates[mCurrState].getRandom(rnd, mIndexExcluded, mScrambleTable, mNumOccurences);
490

  
491
    scramble[curr][0] = info[0];
492
    scramble[curr][1] = info[1];
493
    scramble[curr][2] = info[2];
494

  
495
    mCurrState     = info[3];
496
    mIndexExcluded = info[0];
497
    }
498

  
499
///////////////////////////////////////////////////////////////////////////////////////////////////
500

  
501 464
  public Static3D[] getRotationAxis()
502 465
    {
503 466
    return ROT_AXIS;
src/main/java/org/distorted/objects/TwistyJing.java
31 31
import org.distorted.library.type.Static4D;
32 32
import org.distorted.main.R;
33 33

  
34
import java.util.Random;
35

  
36 34
///////////////////////////////////////////////////////////////////////////////////////////////////
37 35

  
38 36
public class TwistyJing extends TwistyObject
......
55 53
                                 // the length of the edge of the whole tetrahedron.
56 54
                                 // keep < 0.25.
57 55

  
58
  private int mCurrState;
59
  private int mIndexExcluded;
60
  private final ScrambleState[] mStates;
61
  private int[][] mScrambleTable;
62
  private int[] mNumOccurences;
56
  private ScrambleState[] mStates;
63 57
  private int[] mBasicAngle;
64 58
  private int[] mRotQuat;
65 59
  private Static4D[] mQuats;
......
73 67
             DistortedEffects effects, int[][] moves, Resources res, int scrWidth)
74 68
    {
75 69
    super(size, size, quat, texture, mesh, effects, moves, ObjectList.JING, res, scrWidth);
70
    }
76 71

  
77
    int[] tmp = {0,-1,0, 0,1,0, 1,-1,0, 1,1,0 };
72
///////////////////////////////////////////////////////////////////////////////////////////////////
78 73

  
79
    mStates = new ScrambleState[]
74
  ScrambleState[] getScrambleStates()
75
    {
76
    if( mStates==null )
80 77
      {
81
      new ScrambleState( new int[][] {tmp,tmp,tmp,tmp} )
82
      };
78
      int[] tmp = {0,-1,0, 0,1,0, 1,-1,0, 1,1,0 };
79

  
80
      mStates = new ScrambleState[]
81
        {
82
        new ScrambleState( new int[][] {tmp,tmp,tmp,tmp} )
83
        };
84
      }
85

  
86
    return mStates;
83 87
    }
84 88

  
85 89
///////////////////////////////////////////////////////////////////////////////////////////////////
......
408 412
    return getNumLayers()/(SQ6/3);
409 413
    }
410 414

  
411
///////////////////////////////////////////////////////////////////////////////////////////////////
412

  
413
  private void initializeScrambling()
414
    {
415
    int numLayers = getNumLayers();
416

  
417
    if( mScrambleTable ==null )
418
      {
419
      mScrambleTable = new int[NUM_AXIS][numLayers];
420
      }
421
    if( mNumOccurences ==null )
422
      {
423
      int max=0;
424

  
425
      for (ScrambleState mState : mStates)
426
        {
427
        int tmp = mState.getTotal(-1);
428
        if (max < tmp) max = tmp;
429
        }
430

  
431
      mNumOccurences = new int[max];
432
      }
433

  
434
    for(int i=0; i<NUM_AXIS; i++)
435
      for(int j=0; j<numLayers; j++) mScrambleTable[i][j] = 0;
436
    }
437

  
438 415
///////////////////////////////////////////////////////////////////////////////////////////////////
439 416
// PUBLIC API
440 417

  
441
  public void randomizeNewScramble(int[][] scramble, Random rnd, int curr, int totalScrambles)
442
    {
443
    if( curr==0 )
444
      {
445
      mCurrState     = 0;
446
      mIndexExcluded =-1;
447
      initializeScrambling();
448
      }
449

  
450
    int[] info= mStates[mCurrState].getRandom(rnd, mIndexExcluded, mScrambleTable, mNumOccurences);
451

  
452
    scramble[curr][0] = info[0];
453
    scramble[curr][1] = info[1];
454
    scramble[curr][2] = info[2];
455

  
456
    mCurrState     = info[3];
457
    mIndexExcluded = info[0];
458
    }
459

  
460
///////////////////////////////////////////////////////////////////////////////////////////////////
461

  
462 418
  public Static3D[] getRotationAxis()
463 419
    {
464 420
    return ROT_AXIS;
src/main/java/org/distorted/objects/TwistyMinx.java
29 29
import org.distorted.library.type.Static3D;
30 30
import org.distorted.library.type.Static4D;
31 31

  
32
import java.util.Random;
33

  
34 32
///////////////////////////////////////////////////////////////////////////////////////////////////
35 33

  
36 34
abstract class TwistyMinx extends TwistyObject
......
81 79
           MINX_DBLUE , MINX_DYELLOW, MINX_WHITE , MINX_GREY
82 80
         };
83 81

  
84
  private int mCurrState;
85
  private int mIndexExcluded;
86 82
  private ScrambleState[] mStates;
87
  private int[][] mScrambleTable;
88
  private int[] mNumOccurences;
89 83
  private int[] mBasicAngle;
90 84
  private int[] mFaceMap;
91 85
  Static4D[] mQuats;
......
105 99
             DistortedEffects effects, int[][] moves, ObjectList obj, Resources res, int scrWidth)
106 100
    {
107 101
    super(numLayers, realSize, quat, texture, mesh, effects, moves, obj, res, scrWidth);
108

  
109
    initializeScrambleStates(numLayers);
110 102
    }
111 103

  
104
///////////////////////////////////////////////////////////////////////////////////////////////////
105

  
106
  ScrambleState[] getScrambleStates()
107
    {
108
    if( mStates==null )
109
      {
110
      int numLayers = getNumLayers();
111
      initializeScrambleStates(numLayers);
112
      }
113

  
114
    return mStates;
115
    }
112 116

  
113 117
///////////////////////////////////////////////////////////////////////////////////////////////////
114 118

  
......
553 557
    return 2.0f;
554 558
    }
555 559

  
556
///////////////////////////////////////////////////////////////////////////////////////////////////
557

  
558
  private void initializeScrambling()
559
    {
560
    int numLayers = getNumLayers();
561

  
562
    if( mScrambleTable ==null )
563
      {
564
      mScrambleTable = new int[NUM_AXIS][numLayers];
565
      }
566
    if( mNumOccurences ==null )
567
      {
568
      int max=0;
569

  
570
      for (ScrambleState mState : mStates)
571
        {
572
        int tmp = mState.getTotal(-1);
573
        if (max < tmp) max = tmp;
574
        }
575

  
576
      mNumOccurences = new int[max];
577
      }
578

  
579
    for(int i=0; i<NUM_AXIS; i++)
580
      for(int j=0; j<numLayers; j++) mScrambleTable[i][j] = 0;
581
    }
582

  
583 560
///////////////////////////////////////////////////////////////////////////////////////////////////
584 561
// PUBLIC API
585 562

  
586
  public void randomizeNewScramble(int[][] scramble, Random rnd, int curr, int totalScrambles)
587
    {
588
    if( curr==0 )
589
      {
590
      mCurrState     = 0;
591
      mIndexExcluded =-1;
592
      initializeScrambling();
593
      }
594

  
595
    int[] info= mStates[mCurrState].getRandom(rnd, mIndexExcluded, mScrambleTable, mNumOccurences);
596

  
597
    scramble[curr][0] = info[0];
598
    scramble[curr][1] = info[1];
599
    scramble[curr][2] = info[2];
600

  
601
    mCurrState     = info[3];
602
    mIndexExcluded = info[0];
603
    }
604

  
605
///////////////////////////////////////////////////////////////////////////////////////////////////
606

  
607 563
  public Static3D[] getRotationAxis()
608 564
    {
609 565
    return ROT_AXIS;
src/main/java/org/distorted/objects/TwistyObject.java
32 32
import org.distorted.helpers.ObjectShape;
33 33
import org.distorted.helpers.ObjectSticker;
34 34
import org.distorted.helpers.QuatHelper;
35
import org.distorted.helpers.ScrambleState;
35 36
import org.distorted.library.effect.Effect;
36 37
import org.distorted.library.effect.MatrixEffectMove;
37 38
import org.distorted.library.effect.MatrixEffectQuaternion;
......
126 127
  private int mRotRowBitmap;
127 128
  private int mRotAxis;
128 129
  private MeshBase mMesh;
130
  private final TwistyObjectScrambler mScrambler;
129 131

  
130 132
  //////////////////// SOLVED1 ////////////////////////
131 133

  
......
166 168
    NUM_AXIS = mAxis.length;
167 169
    NUM_QUATS = OBJECT_QUATS.length;
168 170

  
171
    int scramblingType = getScrambleType();
172
    ScrambleState[] states = getScrambleStates();
173
    mScrambler = new TwistyObjectScrambler(scramblingType,NUM_AXIS,numLayers,states);
174

  
169 175
    boolean bandaged=false;
170 176

  
171 177
    for(int c=0; c<NUM_CUBITS; c++)
......
746 752
      }
747 753
    }
748 754

  
755
///////////////////////////////////////////////////////////////////////////////////////////////////
756

  
757
  int getScrambleType()
758
    {
759
    return 0;
760
    }
761

  
749 762
///////////////////////////////////////////////////////////////////////////////////////////////////
750 763

  
751 764
  int computeBitmapFromRow(int rowBitmap, int axis)
......
1260 1273
    return mList;
1261 1274
    }
1262 1275

  
1276
///////////////////////////////////////////////////////////////////////////////////////////////////
1277

  
1278
  public void randomizeNewScramble(int[][] scramble, Random rnd, int curr, int total)
1279
    {
1280
    mScrambler.randomizeNewScramble(scramble,rnd,curr,total);
1281
    }
1282

  
1263 1283
///////////////////////////////////////////////////////////////////////////////////////////////////
1264 1284

  
1265 1285
  abstract float getScreenRatio();
......
1280 1300
  abstract ObjectShape getObjectShape(int cubit, int numLayers);
1281 1301
  abstract int[] getSolvedQuats(int cubit, int numLayers);
1282 1302
  abstract int getSolvedFunctionIndex();
1303
  abstract ScrambleState[] getScrambleStates();
1283 1304

  
1284 1305
  public abstract Static3D[] getRotationAxis();
1285 1306
  public abstract int[] getBasicAngle();
1286
  public abstract void randomizeNewScramble(int[][] scramble, Random rnd, int curScramble, int totScrambles);
1287 1307
  public abstract int getObjectName(int numLayers);
1288 1308
  public abstract int getInventor(int numLayers);
1289 1309
  public abstract int getComplexity(int numLayers);
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff