Project

General

Profile

« Previous | Next » 

Revision 7d41fc84

Added by Leszek Koltunski over 1 year ago

Beginnings of support for AI Cube.

View differences:

src/main/java/org/distorted/objectlib/main/ObjectType.java
99 99
  DINO_3 ( TwistyDino6.class          , 10, R.drawable.dino_3, true,     0, new InitData(new int[] {3,3,3,3})),
100 100
  DIN4_3 ( TwistyDino4.class          ,  9, R.drawable.din4_3, true,    30, new InitData(new int[] {3,3,3,3})),
101 101

  
102
  CA_333 ( TwistyCamouflage.class     , 32, R.drawable.din4_3, true,    50, new InitData(new int[] {4,4,4}, TwistyCamouflage.CAM_333)),
102
  BAN5_3 ( TwistyBandagedCuboid.class , 48, R.drawable.ban4_3, true,    50, new InitData(new int[] {4,4,4}, TwistyBandagedCuboid.POS_5)),
103 103

  
104
  PDUO_2 ( TwistyPyraminxDuo.class    ,  4, R.drawable.pduo_2, true,    0, new InitData(new int[] {2,2,2,2})),
105
  PDIA_3 ( TwistyPyraminxDiamond.class, 12, R.drawable.pdia_3, true,   40, new InitData(new int[] {3,3,3})),
106
  BALL_4 ( TwistyMasterball.class     , 28, R.drawable.ball_4, true,   70, new InitData(new int[] {4,2,2,2,2})),
104
  PDUO_2 ( TwistyPyraminxDuo.class    ,  4, R.drawable.pduo_2, false,    0, new InitData(new int[] {2,2,2,2})),
105
  PDIA_3 ( TwistyPyraminxDiamond.class, 12, R.drawable.pdia_3, false,   40, new InitData(new int[] {3,3,3})),
106
  BALL_4 ( TwistyMasterball.class     , 28, R.drawable.ball_4, false,   70, new InitData(new int[] {4,2,2,2,2})),
107
  CA_333 ( TwistyCamouflage.class     , 32, R.drawable.din4_3, false,   50, new InitData(new int[] {4,4,4}, TwistyCamouflage.CAM_333)),
107 108
  ;
108 109

  
109 110
  public static int NUM_OBJECTS;
src/main/java/org/distorted/objectlib/objects/TwistyBandagedAbstract.java
162 162
    return mSolvedQuatsAbstract;
163 163
    }
164 164

  
165
///////////////////////////////////////////////////////////////////////////////////////////////////
166
// Computing scramble states of many a bandaged cubes takes way too long time and too much space.
167
// Return null here and turn to construction of scramble tables just-in-time (scrambleType=2)
168

  
169
  public int[][] getScrambleEdges()
170
    {
171
    return null;
172
    }
173

  
174
///////////////////////////////////////////////////////////////////////////////////////////////////
175

  
176
  @Override
177
  public int getScrambleType()
178
    {
179
    return 2;
180
    }
181

  
182 165
///////////////////////////////////////////////////////////////////////////////////////////////////
183 166

  
184 167
  public float[][] getCuts(int[] numLayers)
src/main/java/org/distorted/objectlib/objects/TwistyBandagedCuboid.java
48 48
         {2,2,2},
49 49
        };
50 50

  
51
  // Fused Cube
51 52
  public static final float[][] POS_1 = new float[][]
52 53
        {
53
          {-1.0f, -1.0f, +0.0f,
54
           -1.0f, -1.0f, +1.0f,
55
           -1.0f,  0.0f, +0.0f,
56
           -1.0f,  0.0f, +1.0f,
57
            0.0f, -1.0f, +0.0f,
58
            0.0f, -1.0f, +1.0f,
59
            0.0f,  0.0f, +0.0f,
60
            0.0f,  0.0f, +1.0f},
54
          {-1.0f, -1.0f, +0.0f, -1.0f, -1.0f, +1.0f, -1.0f,  0.0f, +0.0f, -1.0f,  0.0f, +1.0f,
55
            0.0f, -1.0f, +0.0f,  0.0f, -1.0f, +1.0f,  0.0f,  0.0f, +0.0f,  0.0f,  0.0f, +1.0f },
61 56
          {-1.0f, +1.0f, +1.0f},
62 57
          {-1.0f, +1.0f, +0.0f},
63 58
          {-1.0f, +1.0f, -1.0f},
......
79 74
          { 0.0f,  0.0f, -1.0f}
80 75
        };
81 76

  
77
  // 2-bar cube
82 78
  public static final float[][] POS_2 = new float[][]
83 79
        {
84 80
          { 0.0f, +1.0f,  1.0f, 0.0f, +1.0f,  0.0f, 0.0f, +1.0f, -1.0f},
......
105 101
          { 0.0f, -1.0f, -1.0f}
106 102
        };
107 103

  
104
  // 3-plate cube
108 105
  public static final float[][] POS_3 = new float[][]
109 106
        {
110 107
          {-1.0f,  1.0f,  1.0f, -1.0f,  0.0f,  1.0f,  0.0f,  1.0f,  1.0f,  0.0f,  0.0f,  1.0f},
......
126 123
          { 0.0f,  0.0f, -1.0f}
127 124
        };
128 125

  
126
  // BiCube
129 127
  public static final float[][] POS_4 = new float[][]
130 128
        {
131 129
          { 1.0f,  1.0f, -1.0f},
......
143 141
          { 1.0f, -1.0f, -1.0f,  1.0f,  0.0f, -1.0f}
144 142
        };
145 143

  
144
  // AI Cube
145
  public static final float[][] POS_5 = new float[][]
146
        {
147
          {-1.5f,-1.5f, 1.5f, -0.5f,-1.5f, 1.5f, -1.5f,-0.5f, 1.5f, -0.5f,-0.5f, 1.5f,
148
           -1.5f,-1.5f, 0.5f, -0.5f,-1.5f, 0.5f, -1.5f,-0.5f, 0.5f, -0.5f,-0.5f, 0.5f, },
149
          { 1.5f, 1.5f, 1.5f,  0.5f, 1.5f, 1.5f,  1.5f, 0.5f, 1.5f,  0.5f, 0.5f, 1.5f,
150
            1.5f, 1.5f, 0.5f,  0.5f, 1.5f, 0.5f,  1.5f, 0.5f, 0.5f,  0.5f, 0.5f, 0.5f, },
151
          {-1.5f, 1.5f,-1.5f, -0.5f, 1.5f,-1.5f, -1.5f, 0.5f,-1.5f, -0.5f, 0.5f,-1.5f,
152
           -1.5f, 1.5f,-0.5f, -0.5f, 1.5f,-0.5f, -1.5f, 0.5f,-0.5f, -0.5f, 0.5f,-0.5f, },
153
          { 1.5f,-1.5f,-1.5f,  0.5f,-1.5f,-1.5f,  1.5f,-0.5f,-1.5f,  0.5f,-0.5f,-1.5f,
154
            1.5f,-1.5f,-0.5f,  0.5f,-1.5f,-0.5f,  1.5f,-0.5f,-0.5f,  0.5f,-0.5f,-0.5f, },
155

  
156
          {-1.5f, 1.5f, 1.5f },
157
          {-1.5f, 1.5f, 0.5f },
158
          {-1.5f, 0.5f, 1.5f },
159
          {-1.5f, 0.5f, 0.5f },
160
          {-0.5f, 1.5f, 1.5f },
161
          {-0.5f, 1.5f, 0.5f },
162
          {-0.5f, 0.5f, 1.5f },
163

  
164
          { 1.5f,-1.5f, 1.5f },
165
          { 1.5f,-1.5f, 0.5f },
166
          { 1.5f,-0.5f, 1.5f },
167
          { 1.5f,-0.5f, 0.5f },
168
          { 0.5f,-1.5f, 1.5f },
169
          { 0.5f,-1.5f, 0.5f },
170
          { 0.5f,-0.5f, 1.5f },
171

  
172
          { 1.5f, 1.5f,-1.5f },
173
          { 1.5f, 1.5f,-0.5f },
174
          { 1.5f, 0.5f,-1.5f },
175
          { 1.5f, 0.5f,-0.5f },
176
          { 0.5f, 1.5f,-1.5f },
177
          { 0.5f, 1.5f,-0.5f },
178
          { 0.5f, 0.5f,-1.5f },
179

  
180
          {-1.5f,-1.5f,-1.5f },
181
          {-1.5f,-1.5f,-0.5f },
182
          {-1.5f,-0.5f,-1.5f },
183
          {-1.5f,-0.5f,-0.5f },
184
          {-0.5f,-1.5f,-1.5f },
185
          {-0.5f,-1.5f,-0.5f },
186
          {-0.5f,-0.5f,-1.5f },
187
        };
188

  
189
  private int[][] mEdges;
146 190
  private int[] mCubitVariantMap;
147 191
  private int[] mTypeVariantMap;
148 192
  private Static4D[] mInitQuats;
......
168 212
    super(data, meshState, iconMode, (data.getNumLayers()[0]+data.getNumLayers()[1]+data.getNumLayers()[2])/3.0f, quat, move, scale, stream);
169 213
    }
170 214

  
215
///////////////////////////////////////////////////////////////////////////////////////////////////
216
// Computing scramble states of many a bandaged cubes takes way too long time and too much space.
217
// Return null here and turn to construction of scramble tables just-in-time (scrambleType=2)
218
// Unless this is AI Cube :)
219

  
220
  public int[][] getScrambleEdges()
221
    {
222
    if( mPosition==null ) mPosition = getInitData().getPos();
223

  
224
    if( mPosition==POS_5 )
225
      {
226
      if( mEdges==null )
227
        {
228
        mEdges = new int[][] { {0,0,1,0} };
229
        }
230

  
231
      return mEdges;
232
      }
233

  
234
    return null;
235
    }
236

  
237
///////////////////////////////////////////////////////////////////////////////////////////////////
238
// AI Cube is scrambled using algorithms
239

  
240
  @Override
241
  public int[][] getScrambleAlgorithms()
242
    {
243
    if( mPosition==null ) mPosition = getInitData().getPos();
244

  
245
    if( mPosition==POS_5 )
246
      {
247
      return new int[][]
248
          {
249
              { 0,0,1,1,0,1 },
250
              { 2,0,2 }
251
          };
252
      }
253
    else
254
      {
255
      return super.getScrambleAlgorithms();
256
      }
257
    }
258

  
259
///////////////////////////////////////////////////////////////////////////////////////////////////
260
// AI Cube is scrambled using algorithms
261

  
262
  @Override
263
  public int getScrambleType()
264
    {
265
    if( mPosition==null ) mPosition = getInitData().getPos();
266

  
267
    return mPosition==POS_5 ? 0 : 2;
268
    }
269

  
171 270
///////////////////////////////////////////////////////////////////////////////////////////////////
172 271

  
173 272
  private int getType(float[] pos)
src/main/java/org/distorted/objectlib/objects/TwistyCamouflage.java
130 130
    return 0xff333333;
131 131
    }
132 132

  
133
///////////////////////////////////////////////////////////////////////////////////////////////////
134

  
135
  @Override
136
  public int getScrambleType()
137
    {
138
    return 2;
139
    }
140

  
141
///////////////////////////////////////////////////////////////////////////////////////////////////
142

  
143
  public int[][] getScrambleEdges()
144
    {
145
    return null;
146
    }
147

  
133 148
///////////////////////////////////////////////////////////////////////////////////////////////////
134 149

  
135 150
  private int getDimsIndex(int variant)
src/main/java/org/distorted/objectlib/scrambling/ObjectScrambler.java
117 117
    {
118 118
    if( curr==0 )
119 119
      {
120
      mCurrStep     = 100000;
120 121
      mCurrState    = 0;
121 122
      mAxisExcluded =-1;
122 123
      initializeScrambling();

Also available in: Unified diff