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/TwistyCrazy2x2.java
18 18
import org.distorted.objectlib.helpers.ObjectShape;
19 19
import org.distorted.objectlib.helpers.ObjectSignature;
20 20
import org.distorted.objectlib.helpers.ObjectVertexEffects;
21
import org.distorted.objectlib.scrambling.ScrambleEdgeGenerator;
21 22
import org.distorted.objectlib.main.Cubit;
22 23
import org.distorted.objectlib.main.InitData;
23 24
import org.distorted.objectlib.main.ObjectType;
24 25
import org.distorted.objectlib.shape.ShapeHexahedron;
25
import org.distorted.objectlib.scrambling.ScrambleState;
26 26
import org.distorted.objectlib.touchcontrol.TouchControlHexahedron;
27 27

  
28 28
import static org.distorted.objectlib.touchcontrol.TouchControl.TC_HEXAHEDRON;
......
43 43
           new Static3D(0,0,1)
44 44
         };
45 45

  
46
  private ScrambleState[] mStates;
46
  private int[][] mEdges;
47 47
  private int[][] mBasicAngle;
48 48
  private float[][] mCuts;
49 49
  private float[][] mPositions;
......
108 108
    }
109 109

  
110 110
///////////////////////////////////////////////////////////////////////////////////////////////////
111
// Normal 2x2
112 111

  
113
  public ScrambleState[] getScrambleStates()
112
  public int[][] getScrambleEdges()
114 113
    {
115
    if( mStates==null )
116
      {
117
      int[] m = new int[] { 0,-1,0,0,1,0,0,2,0, 1,-1,0,1,1,0,1,2,0 };
118

  
119
      mStates = new ScrambleState[]
120
          {
121
          new ScrambleState( new int[][] { m,m,m } )
122
          };
123
      }
124

  
125
    return mStates;
114
    if( mEdges==null ) mEdges = ScrambleEdgeGenerator.getScrambleEdgesSingle(mBasicAngle);
115
    return mEdges;
126 116
    }
127 117

  
128 118
///////////////////////////////////////////////////////////////////////////////////////////////////

Also available in: Unified diff