Project

General

Profile

« Previous | Next » 

Revision 9ba7f3f6

Added by Leszek Koltunski over 1 year ago

Move scrambling to a new model where there are spearete scrambling 'algorithms' and 'edges' of the scrambling graph.
Now each edge can contain a whole algorithm, i.e. a sequence of moves leading from state to state, which permits construction of scrambling for more complicated bandaged objects such as the AI cube.

Unchecked as of yet, probably still a lot of bugs.

View differences:

src/main/java/org/distorted/objectlib/objects/TwistyAxis.java
16 16
import org.distorted.objectlib.helpers.ObjectShape;
17 17
import org.distorted.objectlib.helpers.ObjectSignature;
18 18
import org.distorted.objectlib.helpers.ObjectVertexEffects;
19
import org.distorted.objectlib.scrambling.ScrambleEdgeGenerator;
19 20
import org.distorted.objectlib.main.InitData;
20
import org.distorted.objectlib.scrambling.ScrambleState;
21 21
import org.distorted.objectlib.main.ObjectType;
22 22
import org.distorted.objectlib.shape.ShapeHexahedron;
23 23
import org.distorted.objectlib.touchcontrol.TouchControlHexahedron;
......
38 38
           new Static3D( 2.0f/3, 2.0f/3, 1.0f/3),
39 39
         };
40 40

  
41
  private ScrambleState[] mStates;
41
  private int[][] mEdges;
42 42
  private int[][] mBasicAngle;
43 43
  private float[][] mCuts;
44 44
  private float[][] mCenters;
......
60 60
    }
61 61

  
62 62
///////////////////////////////////////////////////////////////////////////////////////////////////
63
// same as in a 3x3
64 63

  
65
  public ScrambleState[] getScrambleStates()
64
  public int[][] getScrambleEdges()
66 65
    {
67
    if( mStates==null )
68
      {
69
      int[][] m = new int[16][];
70

  
71
      for(int i=0; i<16; i++) m[i] = new int[] { 0,-1,i,0,1,i,0,2,i, 1,-1,i,1,1,i,1,2,i, 2,-1,i,2,1,i,2,2,i};
72

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

  
94
    return mStates;
66
    if( mEdges==null ) ScrambleEdgeGenerator.getScrambleEdgesCuboid(3,3,3);
67
    return mEdges;
95 68
    }
96 69

  
97 70
///////////////////////////////////////////////////////////////////////////////////////////////////

Also available in: Unified diff