Project

General

Profile

Download (18.3 KB) Statistics
| Branch: | Tag: | Revision:

magiccube / src / main / java / org / distorted / objects / TwistyDiamond.java @ e1dc3366

1 ece1b58d Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
2
// Copyright 2020 Leszek Koltunski                                                               //
3
//                                                                                               //
4
// This file is part of Magic Cube.                                                              //
5
//                                                                                               //
6
// Magic Cube is free software: you can redistribute it and/or modify                            //
7
// it under the terms of the GNU General Public License as published by                          //
8
// the Free Software Foundation, either version 2 of the License, or                             //
9
// (at your option) any later version.                                                           //
10
//                                                                                               //
11
// Magic Cube is distributed in the hope that it will be useful,                                 //
12
// but WITHOUT ANY WARRANTY; without even the implied warranty of                                //
13
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                                 //
14
// GNU General Public License for more details.                                                  //
15
//                                                                                               //
16
// You should have received a copy of the GNU General Public License                             //
17
// along with Magic Cube.  If not, see <http://www.gnu.org/licenses/>.                           //
18
///////////////////////////////////////////////////////////////////////////////////////////////////
19
20
package org.distorted.objects;
21
22
import android.content.res.Resources;
23
24 f10a88a8 Leszek Koltunski
import org.distorted.helpers.ObjectShape;
25 9c06394a Leszek Koltunski
import org.distorted.helpers.ObjectSticker;
26 6cf89a3e Leszek Koltunski
import org.distorted.helpers.ScrambleState;
27 ece1b58d Leszek Koltunski
import org.distorted.library.main.DistortedEffects;
28
import org.distorted.library.main.DistortedTexture;
29
import org.distorted.library.mesh.MeshSquare;
30
import org.distorted.library.type.Static3D;
31
import org.distorted.library.type.Static4D;
32 6fd4a72c Leszek Koltunski
import org.distorted.main.R;
33 ece1b58d Leszek Koltunski
34
import java.util.Random;
35
36
///////////////////////////////////////////////////////////////////////////////////////////////////
37
38 9c2f0c91 Leszek Koltunski
public class TwistyDiamond extends TwistyObject
39 ece1b58d Leszek Koltunski
{
40
  private static final int FACES_PER_CUBIT =8;
41
42
  // the four rotation axis of a Diamond. Must be normalized.
43
  static final Static3D[] ROT_AXIS = new Static3D[]
44
         {
45
           new Static3D(+SQ6/3,+SQ3/3,     0),
46
           new Static3D(-SQ6/3,+SQ3/3,     0),
47 cc99cf91 Leszek Koltunski
           new Static3D(     0,-SQ3/3,-SQ6/3),
48
           new Static3D(     0,-SQ3/3,+SQ6/3)
49 ece1b58d Leszek Koltunski
         };
50
51 925ed78f Leszek Koltunski
  private static final int[] BASIC_ANGLE = new int[] { 3,3,3,3 };
52
53 ece1b58d Leszek Koltunski
  private static final int[] FACE_COLORS = new int[]
54
         {
55 2ef489e2 Leszek Koltunski
           COLOR_ORANGE, COLOR_VIOLET,
56
           COLOR_WHITE , COLOR_BLUE  ,
57
           COLOR_YELLOW, COLOR_RED   ,
58
           COLOR_GREEN , COLOR_GREY
59 ece1b58d Leszek Koltunski
         };
60
61 a480ee80 Leszek Koltunski
  private static final int[] mFaceMap = new int[] {4,0,6,2,7,3,5,1};
62
63 ab0c28f0 Leszek Koltunski
  // All legal rotation quats of a Diamond: unit + three 180 deg turns + 8 generators
64 ece1b58d Leszek Koltunski
  private static final Static4D[] QUATS = new Static4D[]
65
         {
66
           new Static4D(  0.0f,  0.0f,   0.0f,  1.0f ),
67
           new Static4D(  0.0f,  1.0f,   0.0f,  0.0f ),
68 ab0c28f0 Leszek Koltunski
           new Static4D(+SQ2/2,  0.0f, -SQ2/2,  0.0f ),
69
           new Static4D(-SQ2/2,  0.0f, -SQ2/2,  0.0f ),
70
71 ece1b58d Leszek Koltunski
           new Static4D(+SQ2/2,  0.5f,   0.0f,  0.5f ),
72
           new Static4D(-SQ2/2,  0.5f,   0.0f,  0.5f ),
73
           new Static4D(  0.0f,  0.5f, +SQ2/2,  0.5f ),
74
           new Static4D(  0.0f,  0.5f, -SQ2/2,  0.5f ),
75
           new Static4D(+SQ2/2,  0.5f,   0.0f, -0.5f ),
76
           new Static4D(-SQ2/2,  0.5f,   0.0f, -0.5f ),
77
           new Static4D(  0.0f,  0.5f, +SQ2/2, -0.5f ),
78 ab0c28f0 Leszek Koltunski
           new Static4D(  0.0f,  0.5f, -SQ2/2, -0.5f )
79 ece1b58d Leszek Koltunski
         };
80
81
  private static final float DIST = 0.50f;
82
83 68b5f9c5 Leszek Koltunski
  private static final int[] mTetraToFaceMap = new int[] {1,2,3,0,5,6,7,4};
84
85 31cd7256 Leszek Koltunski
  private static final double[][] VERTICES_TETRA = new double[][]
86 b1f2ccf5 Leszek Koltunski
          {
87
             {-0.5, SQ2/4, 0.0},
88
             { 0.5, SQ2/4, 0.0},
89
             { 0.0,-SQ2/4, 0.5},
90
             { 0.0,-SQ2/4,-0.5}
91
          };
92
93 31cd7256 Leszek Koltunski
  private static final int[][] VERT_INDEXES_TETRA = new int[][]
94 b1f2ccf5 Leszek Koltunski
          {
95
             {2,1,0},   // counterclockwise!
96
             {2,3,1},
97
             {3,2,0},
98
             {3,0,1}
99
          };
100
101 31cd7256 Leszek Koltunski
  private static final double[][] VERTICES_OCTA = new double[][]
102 b1f2ccf5 Leszek Koltunski
          {
103
             { 0.5,   0.0, 0.5},
104
             { 0.5,   0.0,-0.5},
105
             {-0.5,   0.0,-0.5},
106
             {-0.5,   0.0, 0.5},
107
             { 0.0, SQ2/2, 0.0},
108
             { 0.0,-SQ2/2, 0.0}
109
          };
110
111 31cd7256 Leszek Koltunski
  private static final int[][] VERT_INDEXES_OCTA = new int[][]
112 b1f2ccf5 Leszek Koltunski
          {
113
             {3,0,4},   // counterclockwise!
114
             {0,1,4},
115
             {1,2,4},
116
             {2,3,4},
117
             {5,0,3},
118
             {5,1,0},
119
             {5,2,1},
120
             {5,3,2}
121
          };
122
123 31cd7256 Leszek Koltunski
  private static final float[][] STICKERS = new float[][]
124
          {
125
             { -0.4330127f, -0.25f, 0.4330127f, -0.25f, 0.0f, 0.5f }
126
          };
127
128 9c06394a Leszek Koltunski
  private static final ObjectSticker[] mStickers;
129
130
  static
131
    {
132
    float radius = 0.06f;
133
    float stroke = 0.07f;
134
    float[] radii = new float[] {radius,radius,radius};
135
    mStickers = new ObjectSticker[STICKERS.length];
136
    mStickers[0] = new ObjectSticker(STICKERS[0],null,radii,stroke);
137
    }
138
139 486b3417 Leszek Koltunski
  private int mCurrState;
140
  private int mIndexExcluded;
141 6cf89a3e Leszek Koltunski
  private final ScrambleState[] mStates;
142 e1dc3366 Leszek Koltunski
  private int[][] mScrambleTable;
143
  private int[] mNumOccurences;
144 486b3417 Leszek Koltunski
145 ece1b58d Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
146
147 9c2f0c91 Leszek Koltunski
  TwistyDiamond(int size, Static4D quat, DistortedTexture texture,
148
                MeshSquare mesh, DistortedEffects effects, int[][] moves, Resources res, int scrWidth)
149 ece1b58d Leszek Koltunski
    {
150 db875721 Leszek Koltunski
    super(size, size, quat, texture, mesh, effects, moves, ObjectList.DIAM, res, scrWidth);
151 486b3417 Leszek Koltunski
152
    int[] tmp = new int[3*2*size];
153
154
    for(int i=0; i<2*size; i++)
155
      {
156
      tmp[3*i  ] = (i<size) ?  i:i-size;
157
      tmp[3*i+1] = (i%2==0) ? -1:1;
158
      tmp[3*i+2] = 0;
159
      }
160
161 6cf89a3e Leszek Koltunski
    mStates = new ScrambleState[]
162 486b3417 Leszek Koltunski
      {
163 6cf89a3e Leszek Koltunski
      new ScrambleState( new int[][] {tmp,tmp,tmp,tmp} )
164 486b3417 Leszek Koltunski
      };
165 ece1b58d Leszek Koltunski
    }
166
167 a480ee80 Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
168
169
  int[] getSolvedQuats(int cubit, int numLayers)
170
    {
171
    int status = retCubitSolvedStatus(cubit,numLayers);
172
    return status<0 ? null : buildSolvedQuats(MovementDiamond.FACE_AXIS[mFaceMap[status]],QUATS);
173
    }
174
175 ece1b58d Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
176
177
  float getScreenRatio()
178
    {
179 ab0c28f0 Leszek Koltunski
    return 0.65f;
180 ece1b58d Leszek Koltunski
    }
181
182
///////////////////////////////////////////////////////////////////////////////////////////////////
183
184
  Static4D[] getQuats()
185
    {
186
    return QUATS;
187
    }
188
189
///////////////////////////////////////////////////////////////////////////////////////////////////
190
191
  int getNumFaces()
192
    {
193
    return FACE_COLORS.length;
194
    }
195
196
///////////////////////////////////////////////////////////////////////////////////////////////////
197
198
  boolean shouldResetTextureMaps()
199
    {
200
    return false;
201
    }
202
203 169219a7 Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
204
205
  int getSolvedFunctionIndex()
206
    {
207
    return 0;
208
    }
209
210 ece1b58d Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
211
212 a64e07d0 Leszek Koltunski
  int getNumStickerTypes(int numLayers)
213 ece1b58d Leszek Koltunski
    {
214 31cd7256 Leszek Koltunski
    return STICKERS.length;
215 ece1b58d Leszek Koltunski
    }
216
217
///////////////////////////////////////////////////////////////////////////////////////////////////
218
219 e6734aa9 Leszek Koltunski
  float[][] getCuts(int numLayers)
220 ece1b58d Leszek Koltunski
    {
221 680f921e Leszek Koltunski
    if( numLayers<2 )
222
      {
223
      return null;
224
      }
225
    else
226
      {
227 e6734aa9 Leszek Koltunski
      float[][] cuts = new float[4][numLayers-1];
228 68b5f9c5 Leszek Koltunski
      float dist = SQ6*0.666f*DIST;
229 680f921e Leszek Koltunski
      float cut  = 0.5f*dist*(2-numLayers);
230
231
      for(int i=0; i<numLayers-1; i++)
232
        {
233 e6734aa9 Leszek Koltunski
        cuts[0][i] = cut;
234
        cuts[1][i] = cut;
235
        cuts[2][i] = cut;
236
        cuts[3][i] = cut;
237 680f921e Leszek Koltunski
        cut += dist;
238
        }
239
240
      return cuts;
241
      }
242 ece1b58d Leszek Koltunski
    }
243
244
///////////////////////////////////////////////////////////////////////////////////////////////////
245
246
  int getNumCubitFaces()
247
    {
248
    return FACES_PER_CUBIT;
249
    }
250
251
///////////////////////////////////////////////////////////////////////////////////////////////////
252
253 680f921e Leszek Koltunski
  private int getNumOctahedrons(int layers)
254
    {
255
    return layers==1 ? 1 : 4*(layers-1)*(layers-1) + 2;
256
    }
257
258
///////////////////////////////////////////////////////////////////////////////////////////////////
259
260
  private int getNumTetrahedrons(int layers)
261
    {
262
    return 4*layers*(layers-1);
263
    }
264
265
///////////////////////////////////////////////////////////////////////////////////////////////////
266
267 31cd7256 Leszek Koltunski
  private int createOctaPositions(float[][] centers, int index, int layers, float height)
268 680f921e Leszek Koltunski
    {
269
    float x = DIST*(layers-1);
270
    float z = DIST*(layers+1);
271
272
    for(int i=0; i<layers; i++, index++)
273
      {
274
      z -= 2*DIST;
275
      centers[index][0] = x;
276
      centers[index][1] = height;
277
      centers[index][2] = z;
278
      }
279
280
    for(int i=0; i<layers-1; i++, index++)
281
      {
282
      x -= 2*DIST;
283
      centers[index][0] = x;
284
      centers[index][1] = height;
285
      centers[index][2] = z;
286
      }
287
288
    for(int i=0; i<layers-1; i++, index++)
289
      {
290
      z += 2*DIST;
291
      centers[index][0] = x;
292
      centers[index][1] = height;
293
      centers[index][2] = z;
294
      }
295
296
    for(int i=0; i<layers-2; i++, index++)
297
      {
298
      x += 2*DIST;
299
      centers[index][0] = x;
300
      centers[index][1] = height;
301
      centers[index][2] = z;
302
      }
303
304
    return index;
305
    }
306
307
///////////////////////////////////////////////////////////////////////////////////////////////////
308
309 31cd7256 Leszek Koltunski
  private int createTetraPositions(float[][] centers, int index, int layers, float height)
310 ece1b58d Leszek Koltunski
    {
311 680f921e Leszek Koltunski
    float x = DIST*(layers-1);
312
    float z = DIST*layers;
313
314
    for(int i=0; i<layers-1; i++, index++)
315
      {
316
      z -= 2*DIST;
317
      centers[index][0] = x;
318
      centers[index][1] = height;
319
      centers[index][2] = z;
320
      }
321
322
    x += DIST;
323
    z -= DIST;
324
325
    for(int i=0; i<layers-1; i++, index++)
326
      {
327
      x -= 2*DIST;
328
      centers[index][0] = x;
329
      centers[index][1] = height;
330
      centers[index][2] = z;
331
      }
332
333
    x -= DIST;
334
    z -= DIST;
335
336
    for(int i=0; i<layers-1; i++, index++)
337
      {
338
      z += 2*DIST;
339
      centers[index][0] = x;
340
      centers[index][1] = height;
341
      centers[index][2] = z;
342
      }
343
344
    x -= DIST;
345
    z += DIST;
346
347
    for(int i=0; i<layers-1; i++, index++)
348
      {
349
      x += 2*DIST;
350
      centers[index][0] = x;
351
      centers[index][1] = height;
352
      centers[index][2] = z;
353
      }
354
355
    return index;
356
    }
357
358
///////////////////////////////////////////////////////////////////////////////////////////////////
359
360
  float[][] getCubitPositions(int layers)
361
    {
362
    int numO = getNumOctahedrons(layers);
363
    int numT = getNumTetrahedrons(layers);
364
    int index = 0;
365
    float height = 0.0f;
366
367
    float[][] CENTERS = new float[numO+numT][3];
368
369 31cd7256 Leszek Koltunski
    index = createOctaPositions(CENTERS,index,layers,height);
370 680f921e Leszek Koltunski
371
    for(int i=layers-1; i>0; i--)
372
      {
373
      height += SQ2*DIST;
374 31cd7256 Leszek Koltunski
      index = createOctaPositions(CENTERS,index,i,+height);
375
      index = createOctaPositions(CENTERS,index,i,-height);
376 680f921e Leszek Koltunski
      }
377
378
    height = DIST*SQ2/2;
379
380
    for(int i=layers; i>1; i--)
381
      {
382 31cd7256 Leszek Koltunski
      index = createTetraPositions(CENTERS,index,i,+height);
383
      index = createTetraPositions(CENTERS,index,i,-height);
384 680f921e Leszek Koltunski
      height += SQ2*DIST;
385
      }
386
387 ece1b58d Leszek Koltunski
    return CENTERS;
388
    }
389
390
///////////////////////////////////////////////////////////////////////////////////////////////////
391
392 680f921e Leszek Koltunski
  private int retFaceTetraBelongsTo(int tetra, int numLayers)
393 ece1b58d Leszek Koltunski
    {
394 68b5f9c5 Leszek Koltunski
    for(int i=numLayers-1; i>0; i--)
395 ece1b58d Leszek Koltunski
      {
396 68b5f9c5 Leszek Koltunski
      if( tetra < 8*i ) return mTetraToFaceMap[tetra/i];
397
      tetra -= 8*i;
398 680f921e Leszek Koltunski
      }
399 68b5f9c5 Leszek Koltunski
400
    return -1;
401 680f921e Leszek Koltunski
    }
402
403 f10a88a8 Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
404
405
  ObjectShape getObjectShape(int cubit, int numLayers)
406
    {
407
    int variant = getCubitVariant(cubit,numLayers);
408 f56b53cb Leszek Koltunski
    int N = numLayers>3 ? 5:6;
409 7d11f930 Leszek Koltunski
    int E = numLayers>2 ? (numLayers>3 ? 0:1):2;
410 ece1b58d Leszek Koltunski
411 f10a88a8 Leszek Koltunski
    if( variant==0 )
412 ece1b58d Leszek Koltunski
      {
413 f10a88a8 Leszek Koltunski
      float[][] bands     = new float[][] { {0.05f,35,0.5f,0.8f,N,E,E} };
414
      int[] bandIndices   = new int[] { 0,0,0,0,0,0,0,0 };
415
      float[][] corners   = new float[][] { {0.04f,0.20f} };
416
      int[] cornerIndices = new int[] { 0,0,0,0,0,0 };
417
      float[][] centers   = new float[][] { {0.0f, 0.0f, 0.0f} };
418
      int[] centerIndices = new int[] { 0,0,0,0,0,0 };
419
      return new ObjectShape(VERTICES_OCTA,VERT_INDEXES_OCTA,bands,bandIndices,corners,cornerIndices,centers,centerIndices,getNumCubitFaces(), null);
420 ece1b58d Leszek Koltunski
      }
421
    else
422
      {
423 f10a88a8 Leszek Koltunski
      float[][] bands     = new float[][] { {0.05f,35,0.5f,0.8f,N,E,E} };
424
      int[] bandIndices   = new int[] { 0,0,0,0 };
425
      float[][] corners   = new float[][] { {0.08f,0.15f} };
426
      int[] cornerIndices = new int[] { 0,0,0,0 };
427
      float[][] centers   = new float[][] { {0.0f, 0.0f, 0.0f} };
428
      int[] centerIndices = new int[] { 0,0,0,0 };
429
      return new ObjectShape(VERTICES_TETRA,VERT_INDEXES_TETRA,bands,bandIndices,corners,cornerIndices,centers,centerIndices,getNumCubitFaces(), null);
430
      }
431
    }
432
433
///////////////////////////////////////////////////////////////////////////////////////////////////
434
435 3e605536 Leszek Koltunski
  Static4D getQuat(int cubit, int numLayers)
436 f10a88a8 Leszek Koltunski
    {
437 3e605536 Leszek Koltunski
    int numO = getNumOctahedrons(numLayers);
438 f10a88a8 Leszek Koltunski
439 3e605536 Leszek Koltunski
    if( cubit<numO ) return QUATS[0];
440 f10a88a8 Leszek Koltunski
441 3e605536 Leszek Koltunski
    switch( retFaceTetraBelongsTo(cubit-numO, numLayers) )
442 f10a88a8 Leszek Koltunski
      {
443 3e605536 Leszek Koltunski
      case 0: return QUATS[0];                          // unit quat
444
      case 1: return new Static4D(0,-SQ2/2,0,SQ2/2);    //  90 along Y
445
      case 2: return QUATS[1];                          // 180 along Y
446
      case 3: return new Static4D(0,+SQ2/2,0,SQ2/2);    //  90 along
447
      case 4: return new Static4D(0,     0,1,    0);    // 180 along Z
448
      case 5: return new Static4D(SQ2/2, 0,SQ2/2,0);    //
449
      case 6: return new Static4D(     1,0,0,    0);    // 180 along X
450
      case 7: return new Static4D(-SQ2/2,0,SQ2/2,0);    //
451 ece1b58d Leszek Koltunski
      }
452
453 3e605536 Leszek Koltunski
    return null;
454
    }
455
456
///////////////////////////////////////////////////////////////////////////////////////////////////
457 ece1b58d Leszek Koltunski
458 3e605536 Leszek Koltunski
  int getNumCubitVariants(int numLayers)
459
    {
460
    return 2;
461
    }
462
463
///////////////////////////////////////////////////////////////////////////////////////////////////
464
465
  int getCubitVariant(int cubit, int numLayers)
466
    {
467
    return cubit<getNumOctahedrons(numLayers) ? 0 : 1;
468 ece1b58d Leszek Koltunski
    }
469
470
///////////////////////////////////////////////////////////////////////////////////////////////////
471
472 2ef489e2 Leszek Koltunski
  int getFaceColor(int cubit, int cubitface, int size)
473 ece1b58d Leszek Koltunski
    {
474 2ef489e2 Leszek Koltunski
    int numO = getNumOctahedrons(size);
475 680f921e Leszek Koltunski
476
    if( cubit<numO )
477
      {
478 2ef489e2 Leszek Koltunski
      int axis = 0;
479
      int layer= 1;
480
481
      switch(cubitface)
482
        {
483
        case 0: axis = 2; layer =             1; break;
484
        case 1: axis = 0; layer = (1<<(size-1)); break;
485
        case 2: axis = 3; layer =             1; break;
486
        case 3: axis = 1; layer = (1<<(size-1)); break;
487
        case 4: axis = 3; layer = (1<<(size-1)); break;
488
        case 5: axis = 1; layer =             1; break;
489
        case 6: axis = 2; layer = (1<<(size-1)); break;
490
        case 7: axis = 0; layer =             1; break;
491
        }
492
493 a4962b9c Leszek Koltunski
      return CUBITS[cubit].mRotationRow[axis] == layer ? cubitface : NUM_TEXTURES;
494 680f921e Leszek Koltunski
      }
495
    else
496
      {
497 a4962b9c Leszek Koltunski
      return cubitface>0 ? NUM_TEXTURES : retFaceTetraBelongsTo(cubit-numO, size);
498 680f921e Leszek Koltunski
      }
499 ece1b58d Leszek Koltunski
    }
500
501
///////////////////////////////////////////////////////////////////////////////////////////////////
502
503 9c06394a Leszek Koltunski
  int getColor(int face)
504 ece1b58d Leszek Koltunski
    {
505 9c06394a Leszek Koltunski
    return FACE_COLORS[face];
506
    }
507
508
///////////////////////////////////////////////////////////////////////////////////////////////////
509 76c2bd07 Leszek Koltunski
510 9c06394a Leszek Koltunski
  ObjectSticker retSticker(int face)
511
    {
512
    return mStickers[face/NUM_FACES];
513 ece1b58d Leszek Koltunski
    }
514
515
///////////////////////////////////////////////////////////////////////////////////////////////////
516
517
  float returnMultiplier()
518
    {
519 cc99cf91 Leszek Koltunski
    return 1.5f;
520 ece1b58d Leszek Koltunski
    }
521
522
///////////////////////////////////////////////////////////////////////////////////////////////////
523
524 e1dc3366 Leszek Koltunski
  private void initializeScrambling()
525 ece1b58d Leszek Koltunski
    {
526 e1dc3366 Leszek Koltunski
    int numLayers = getNumLayers();
527 ece1b58d Leszek Koltunski
528 e1dc3366 Leszek Koltunski
    if( mScrambleTable ==null )
529
      {
530
      mScrambleTable = new int[NUM_AXIS][numLayers];
531
      }
532
    if( mNumOccurences ==null )
533
      {
534
      int max=0;
535 ece1b58d Leszek Koltunski
536 e1dc3366 Leszek Koltunski
      for (ScrambleState mState : mStates)
537
        {
538
        int tmp = mState.getTotal(-1);
539
        if (max < tmp) max = tmp;
540
        }
541
542
      mNumOccurences = new int[max];
543
      }
544
545
    for(int i=0; i<NUM_AXIS; i++)
546
      for(int j=0; j<numLayers; j++) mScrambleTable[i][j] = 0;
547 ece1b58d Leszek Koltunski
    }
548
549
///////////////////////////////////////////////////////////////////////////////////////////////////
550 e1dc3366 Leszek Koltunski
// PUBLIC API
551 ece1b58d Leszek Koltunski
552 486b3417 Leszek Koltunski
  public void randomizeNewScramble(int[][] scramble, Random rnd, int curr, int totalScrambles)
553 ece1b58d Leszek Koltunski
    {
554 9f171eba Leszek Koltunski
    if( curr==0 )
555 ece1b58d Leszek Koltunski
      {
556 486b3417 Leszek Koltunski
      mCurrState     = 0;
557
      mIndexExcluded =-1;
558 e1dc3366 Leszek Koltunski
      initializeScrambling();
559 ece1b58d Leszek Koltunski
      }
560
561 e1dc3366 Leszek Koltunski
    int[] info= mStates[mCurrState].getRandom(rnd, mIndexExcluded, mScrambleTable, mNumOccurences);
562 ece1b58d Leszek Koltunski
563 486b3417 Leszek Koltunski
    scramble[curr][0] = info[0];
564
    scramble[curr][1] = info[1];
565
    scramble[curr][2] = info[2];
566 ece1b58d Leszek Koltunski
567 486b3417 Leszek Koltunski
    mCurrState     = info[3];
568
    mIndexExcluded = info[0];
569 ece1b58d Leszek Koltunski
    }
570
571 e1dc3366 Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
572
573
  public Static3D[] getRotationAxis()
574
    {
575
    return ROT_AXIS;
576
    }
577
578
///////////////////////////////////////////////////////////////////////////////////////////////////
579
580
  public int[] getBasicAngle()
581
    {
582
    return BASIC_ANGLE;
583
    }
584
585 6fd4a72c Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
586
587
  public int getObjectName(int numLayers)
588
    {
589 2ef489e2 Leszek Koltunski
    switch(numLayers)
590
      {
591
      case 2: return R.string.diam2;
592
      case 3: return R.string.diam3;
593 2adf1263 Leszek Koltunski
      case 4: return R.string.diam4;
594 2ef489e2 Leszek Koltunski
      }
595
596
    return 0;
597 6fd4a72c Leszek Koltunski
    }
598
599
///////////////////////////////////////////////////////////////////////////////////////////////////
600
601
  public int getInventor(int numLayers)
602
    {
603 2ef489e2 Leszek Koltunski
    switch(numLayers)
604
      {
605
      case 2: return R.string.diam2_inventor;
606
      case 3: return R.string.diam3_inventor;
607 2adf1263 Leszek Koltunski
      case 4: return R.string.diam4_inventor;
608 2ef489e2 Leszek Koltunski
      }
609
610
    return 0;
611 6fd4a72c Leszek Koltunski
    }
612
613
///////////////////////////////////////////////////////////////////////////////////////////////////
614
615
  public int getComplexity(int numLayers)
616
    {
617 2ef489e2 Leszek Koltunski
    switch(numLayers)
618
      {
619 2adf1263 Leszek Koltunski
      case 2: return 4;
620
      case 3: return 6;
621
      case 4: return 8;
622 2ef489e2 Leszek Koltunski
      }
623
624
    return 0;
625 6fd4a72c Leszek Koltunski
    }
626 ece1b58d Leszek Koltunski
}