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/TwistySquare2.java
21 21
import org.distorted.objectlib.main.InitData;
22 22
import org.distorted.objectlib.main.ObjectType;
23 23
import org.distorted.objectlib.helpers.ObjectShape;
24
import org.distorted.objectlib.scrambling.ScrambleState;
25 24

  
26 25
///////////////////////////////////////////////////////////////////////////////////////////////////
27 26

  
28 27
public class TwistySquare2 extends TwistySquare
29 28
{
30
  private ScrambleState[] mStates;
29
  private int[][] mEdges;
31 30
  private int[] mQuatIndex;
32 31
  private float[][] mCenters;
33 32

  
......
53 52

  
54 53
///////////////////////////////////////////////////////////////////////////////////////////////////
55 54

  
56
  public ScrambleState[] getScrambleStates()
55
  public int[][] getScrambleEdges()
57 56
    {
58
    if( mStates==null )
57
    if( mEdges==null )
59 58
      {
60
      int[] SL_6 = new int[] { 0,1,1, 1,1,1, 0,1,1, 1,1,1, 0,1,1, 1,1,1, 0,1,1, 1,1,1, 0,1,1, 1,1,1, 0,1,1, 1,1,1};
61
      int[] SL_1 = new int[] { 0,1,1, 1,1,1 };
62
      int[] LO_2 = new int[] { 0,-5,2, 0,-4,2, 0,-3,2, 0,-2,2, 0,-1,2, 0,1,2, 0,2,2, 0,3,2, 0,4,2, 0,5,2, 0,5,2 };
63
      int[] LO_3 = new int[] { 0,-5,3, 0,-4,3, 0,-3,3, 0,-2,3, 0,-1,3, 0,1,3, 0,2,3, 0,3,3, 0,4,3, 0,5,3, 0,5,3 };
64
      int[] LO_4 = new int[] { 0,-5,4, 0,-4,4, 0,-3,4, 0,-2,4, 0,-1,4, 0,1,4, 0,2,4, 0,3,4, 0,4,4, 0,5,4, 0,5,4 };
65

  
66
      mStates = new ScrambleState[]
59
      mEdges = new int[][]
67 60
        {
68
        new ScrambleState( new int[][] { LO_2, SL_6, LO_3 } ),  // 0
69
        new ScrambleState( new int[][] { LO_2, null, LO_3 } ),  // SL
70
        new ScrambleState( new int[][] { null, SL_1, LO_4 } ),  // LO
71
        new ScrambleState( new int[][] { LO_4, SL_1, null } ),  // UP
72
        new ScrambleState( new int[][] { null, SL_1, null } ),  // UL
61
          { 0,2,1,2,2,2,3,2,4,2,5,2,6,2,7,2,8,2,9,2,10,2,
62
            33,1,34,1,33,1,34,1,33,1,34,1,33,1,34,1,33,1,34,1,33,1,34,1,
63
            35,3,36,3,37,3,38,3,39,3,40,3,41,3,42,3,43,3,44,3,45,3 },     // 0
64
          { 0,2,1,2,2,2,3,2,4,2,5,2,6,2,7,2,8,2,9,2,10,2,
65
            35,3,36,3,37,3,38,3,39,3,40,3,41,3,42,3,43,3,44,3,45,3 },     // 1 SL
66
          { 33,1,34,1,
67
            35,4,36,4,37,4,38,4,39,4,40,4,41,4,42,4,43,4,44,4,45,4 },     // 2 LO
68
          { 0,4,1,4,2,4,3,4,4,4,5,4,6,4,7,4,8,4,9,4,10,4,
69
            33,1,34,1 },                                                  // 3 UP
70
          { 33,1,34,1 }                                                   // 4 UL
73 71
        };
74 72
      }
75 73

  
76
    return mStates;
74
    return mEdges;
77 75
    }
78 76

  
79 77
///////////////////////////////////////////////////////////////////////////////////////////////////

Also available in: Unified diff