Project

General

Profile

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

magiccube / src / main / java / org / distorted / objects / TwistyDiamond.java @ 6cf89a3e

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 486b3417 Leszek Koltunski
143 ece1b58d Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
144
145 9c2f0c91 Leszek Koltunski
  TwistyDiamond(int size, Static4D quat, DistortedTexture texture,
146
                MeshSquare mesh, DistortedEffects effects, int[][] moves, Resources res, int scrWidth)
147 ece1b58d Leszek Koltunski
    {
148 db875721 Leszek Koltunski
    super(size, size, quat, texture, mesh, effects, moves, ObjectList.DIAM, res, scrWidth);
149 486b3417 Leszek Koltunski
150
    int[] tmp = new int[3*2*size];
151
152
    for(int i=0; i<2*size; i++)
153
      {
154
      tmp[3*i  ] = (i<size) ?  i:i-size;
155
      tmp[3*i+1] = (i%2==0) ? -1:1;
156
      tmp[3*i+2] = 0;
157
      }
158
159 6cf89a3e Leszek Koltunski
    mStates = new ScrambleState[]
160 486b3417 Leszek Koltunski
      {
161 6cf89a3e Leszek Koltunski
      new ScrambleState( new int[][] {tmp,tmp,tmp,tmp} )
162 486b3417 Leszek Koltunski
      };
163 ece1b58d Leszek Koltunski
    }
164
165 a480ee80 Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
166
167
  int[] getSolvedQuats(int cubit, int numLayers)
168
    {
169
    int status = retCubitSolvedStatus(cubit,numLayers);
170
    return status<0 ? null : buildSolvedQuats(MovementDiamond.FACE_AXIS[mFaceMap[status]],QUATS);
171
    }
172
173 ece1b58d Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
174
175
  float getScreenRatio()
176
    {
177 ab0c28f0 Leszek Koltunski
    return 0.65f;
178 ece1b58d Leszek Koltunski
    }
179
180
///////////////////////////////////////////////////////////////////////////////////////////////////
181
182
  Static4D[] getQuats()
183
    {
184
    return QUATS;
185
    }
186
187
///////////////////////////////////////////////////////////////////////////////////////////////////
188
189
  int getNumFaces()
190
    {
191
    return FACE_COLORS.length;
192
    }
193
194
///////////////////////////////////////////////////////////////////////////////////////////////////
195
196
  boolean shouldResetTextureMaps()
197
    {
198
    return false;
199
    }
200
201 169219a7 Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
202
203
  int getSolvedFunctionIndex()
204
    {
205
    return 0;
206
    }
207
208 ece1b58d Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
209
210 a64e07d0 Leszek Koltunski
  int getNumStickerTypes(int numLayers)
211 ece1b58d Leszek Koltunski
    {
212 31cd7256 Leszek Koltunski
    return STICKERS.length;
213 ece1b58d Leszek Koltunski
    }
214
215
///////////////////////////////////////////////////////////////////////////////////////////////////
216
217 e6734aa9 Leszek Koltunski
  float[][] getCuts(int numLayers)
218 ece1b58d Leszek Koltunski
    {
219 680f921e Leszek Koltunski
    if( numLayers<2 )
220
      {
221
      return null;
222
      }
223
    else
224
      {
225 e6734aa9 Leszek Koltunski
      float[][] cuts = new float[4][numLayers-1];
226 68b5f9c5 Leszek Koltunski
      float dist = SQ6*0.666f*DIST;
227 680f921e Leszek Koltunski
      float cut  = 0.5f*dist*(2-numLayers);
228
229
      for(int i=0; i<numLayers-1; i++)
230
        {
231 e6734aa9 Leszek Koltunski
        cuts[0][i] = cut;
232
        cuts[1][i] = cut;
233
        cuts[2][i] = cut;
234
        cuts[3][i] = cut;
235 680f921e Leszek Koltunski
        cut += dist;
236
        }
237
238
      return cuts;
239
      }
240 ece1b58d Leszek Koltunski
    }
241
242
///////////////////////////////////////////////////////////////////////////////////////////////////
243
244
  int getNumCubitFaces()
245
    {
246
    return FACES_PER_CUBIT;
247
    }
248
249
///////////////////////////////////////////////////////////////////////////////////////////////////
250
251 680f921e Leszek Koltunski
  private int getNumOctahedrons(int layers)
252
    {
253
    return layers==1 ? 1 : 4*(layers-1)*(layers-1) + 2;
254
    }
255
256
///////////////////////////////////////////////////////////////////////////////////////////////////
257
258
  private int getNumTetrahedrons(int layers)
259
    {
260
    return 4*layers*(layers-1);
261
    }
262
263
///////////////////////////////////////////////////////////////////////////////////////////////////
264
265 31cd7256 Leszek Koltunski
  private int createOctaPositions(float[][] centers, int index, int layers, float height)
266 680f921e Leszek Koltunski
    {
267
    float x = DIST*(layers-1);
268
    float z = DIST*(layers+1);
269
270
    for(int i=0; i<layers; i++, index++)
271
      {
272
      z -= 2*DIST;
273
      centers[index][0] = x;
274
      centers[index][1] = height;
275
      centers[index][2] = z;
276
      }
277
278
    for(int i=0; i<layers-1; i++, index++)
279
      {
280
      x -= 2*DIST;
281
      centers[index][0] = x;
282
      centers[index][1] = height;
283
      centers[index][2] = z;
284
      }
285
286
    for(int i=0; i<layers-1; i++, index++)
287
      {
288
      z += 2*DIST;
289
      centers[index][0] = x;
290
      centers[index][1] = height;
291
      centers[index][2] = z;
292
      }
293
294
    for(int i=0; i<layers-2; i++, index++)
295
      {
296
      x += 2*DIST;
297
      centers[index][0] = x;
298
      centers[index][1] = height;
299
      centers[index][2] = z;
300
      }
301
302
    return index;
303
    }
304
305
///////////////////////////////////////////////////////////////////////////////////////////////////
306
307 31cd7256 Leszek Koltunski
  private int createTetraPositions(float[][] centers, int index, int layers, float height)
308 ece1b58d Leszek Koltunski
    {
309 680f921e Leszek Koltunski
    float x = DIST*(layers-1);
310
    float z = DIST*layers;
311
312
    for(int i=0; i<layers-1; i++, index++)
313
      {
314
      z -= 2*DIST;
315
      centers[index][0] = x;
316
      centers[index][1] = height;
317
      centers[index][2] = z;
318
      }
319
320
    x += DIST;
321
    z -= DIST;
322
323
    for(int i=0; i<layers-1; i++, index++)
324
      {
325
      x -= 2*DIST;
326
      centers[index][0] = x;
327
      centers[index][1] = height;
328
      centers[index][2] = z;
329
      }
330
331
    x -= DIST;
332
    z -= DIST;
333
334
    for(int i=0; i<layers-1; i++, index++)
335
      {
336
      z += 2*DIST;
337
      centers[index][0] = x;
338
      centers[index][1] = height;
339
      centers[index][2] = z;
340
      }
341
342
    x -= DIST;
343
    z += DIST;
344
345
    for(int i=0; i<layers-1; i++, index++)
346
      {
347
      x += 2*DIST;
348
      centers[index][0] = x;
349
      centers[index][1] = height;
350
      centers[index][2] = z;
351
      }
352
353
    return index;
354
    }
355
356
///////////////////////////////////////////////////////////////////////////////////////////////////
357
358
  float[][] getCubitPositions(int layers)
359
    {
360
    int numO = getNumOctahedrons(layers);
361
    int numT = getNumTetrahedrons(layers);
362
    int index = 0;
363
    float height = 0.0f;
364
365
    float[][] CENTERS = new float[numO+numT][3];
366
367 31cd7256 Leszek Koltunski
    index = createOctaPositions(CENTERS,index,layers,height);
368 680f921e Leszek Koltunski
369
    for(int i=layers-1; i>0; i--)
370
      {
371
      height += SQ2*DIST;
372 31cd7256 Leszek Koltunski
      index = createOctaPositions(CENTERS,index,i,+height);
373
      index = createOctaPositions(CENTERS,index,i,-height);
374 680f921e Leszek Koltunski
      }
375
376
    height = DIST*SQ2/2;
377
378
    for(int i=layers; i>1; i--)
379
      {
380 31cd7256 Leszek Koltunski
      index = createTetraPositions(CENTERS,index,i,+height);
381
      index = createTetraPositions(CENTERS,index,i,-height);
382 680f921e Leszek Koltunski
      height += SQ2*DIST;
383
      }
384
385 ece1b58d Leszek Koltunski
    return CENTERS;
386
    }
387
388
///////////////////////////////////////////////////////////////////////////////////////////////////
389
390 680f921e Leszek Koltunski
  private int retFaceTetraBelongsTo(int tetra, int numLayers)
391 ece1b58d Leszek Koltunski
    {
392 68b5f9c5 Leszek Koltunski
    for(int i=numLayers-1; i>0; i--)
393 ece1b58d Leszek Koltunski
      {
394 68b5f9c5 Leszek Koltunski
      if( tetra < 8*i ) return mTetraToFaceMap[tetra/i];
395
      tetra -= 8*i;
396 680f921e Leszek Koltunski
      }
397 68b5f9c5 Leszek Koltunski
398
    return -1;
399 680f921e Leszek Koltunski
    }
400
401 f10a88a8 Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
402
403
  ObjectShape getObjectShape(int cubit, int numLayers)
404
    {
405
    int variant = getCubitVariant(cubit,numLayers);
406 f56b53cb Leszek Koltunski
    int N = numLayers>3 ? 5:6;
407 7d11f930 Leszek Koltunski
    int E = numLayers>2 ? (numLayers>3 ? 0:1):2;
408 ece1b58d Leszek Koltunski
409 f10a88a8 Leszek Koltunski
    if( variant==0 )
410 ece1b58d Leszek Koltunski
      {
411 f10a88a8 Leszek Koltunski
      float[][] bands     = new float[][] { {0.05f,35,0.5f,0.8f,N,E,E} };
412
      int[] bandIndices   = new int[] { 0,0,0,0,0,0,0,0 };
413
      float[][] corners   = new float[][] { {0.04f,0.20f} };
414
      int[] cornerIndices = new int[] { 0,0,0,0,0,0 };
415
      float[][] centers   = new float[][] { {0.0f, 0.0f, 0.0f} };
416
      int[] centerIndices = new int[] { 0,0,0,0,0,0 };
417
      return new ObjectShape(VERTICES_OCTA,VERT_INDEXES_OCTA,bands,bandIndices,corners,cornerIndices,centers,centerIndices,getNumCubitFaces(), null);
418 ece1b58d Leszek Koltunski
      }
419
    else
420
      {
421 f10a88a8 Leszek Koltunski
      float[][] bands     = new float[][] { {0.05f,35,0.5f,0.8f,N,E,E} };
422
      int[] bandIndices   = new int[] { 0,0,0,0 };
423
      float[][] corners   = new float[][] { {0.08f,0.15f} };
424
      int[] cornerIndices = new int[] { 0,0,0,0 };
425
      float[][] centers   = new float[][] { {0.0f, 0.0f, 0.0f} };
426
      int[] centerIndices = new int[] { 0,0,0,0 };
427
      return new ObjectShape(VERTICES_TETRA,VERT_INDEXES_TETRA,bands,bandIndices,corners,cornerIndices,centers,centerIndices,getNumCubitFaces(), null);
428
      }
429
    }
430
431
///////////////////////////////////////////////////////////////////////////////////////////////////
432
433 3e605536 Leszek Koltunski
  Static4D getQuat(int cubit, int numLayers)
434 f10a88a8 Leszek Koltunski
    {
435 3e605536 Leszek Koltunski
    int numO = getNumOctahedrons(numLayers);
436 f10a88a8 Leszek Koltunski
437 3e605536 Leszek Koltunski
    if( cubit<numO ) return QUATS[0];
438 f10a88a8 Leszek Koltunski
439 3e605536 Leszek Koltunski
    switch( retFaceTetraBelongsTo(cubit-numO, numLayers) )
440 f10a88a8 Leszek Koltunski
      {
441 3e605536 Leszek Koltunski
      case 0: return QUATS[0];                          // unit quat
442
      case 1: return new Static4D(0,-SQ2/2,0,SQ2/2);    //  90 along Y
443
      case 2: return QUATS[1];                          // 180 along Y
444
      case 3: return new Static4D(0,+SQ2/2,0,SQ2/2);    //  90 along
445
      case 4: return new Static4D(0,     0,1,    0);    // 180 along Z
446
      case 5: return new Static4D(SQ2/2, 0,SQ2/2,0);    //
447
      case 6: return new Static4D(     1,0,0,    0);    // 180 along X
448
      case 7: return new Static4D(-SQ2/2,0,SQ2/2,0);    //
449 ece1b58d Leszek Koltunski
      }
450
451 3e605536 Leszek Koltunski
    return null;
452
    }
453
454
///////////////////////////////////////////////////////////////////////////////////////////////////
455 ece1b58d Leszek Koltunski
456 3e605536 Leszek Koltunski
  int getNumCubitVariants(int numLayers)
457
    {
458
    return 2;
459
    }
460
461
///////////////////////////////////////////////////////////////////////////////////////////////////
462
463
  int getCubitVariant(int cubit, int numLayers)
464
    {
465
    return cubit<getNumOctahedrons(numLayers) ? 0 : 1;
466 ece1b58d Leszek Koltunski
    }
467
468
///////////////////////////////////////////////////////////////////////////////////////////////////
469
470 2ef489e2 Leszek Koltunski
  int getFaceColor(int cubit, int cubitface, int size)
471 ece1b58d Leszek Koltunski
    {
472 2ef489e2 Leszek Koltunski
    int numO = getNumOctahedrons(size);
473 680f921e Leszek Koltunski
474
    if( cubit<numO )
475
      {
476 2ef489e2 Leszek Koltunski
      int axis = 0;
477
      int layer= 1;
478
479
      switch(cubitface)
480
        {
481
        case 0: axis = 2; layer =             1; break;
482
        case 1: axis = 0; layer = (1<<(size-1)); break;
483
        case 2: axis = 3; layer =             1; break;
484
        case 3: axis = 1; layer = (1<<(size-1)); break;
485
        case 4: axis = 3; layer = (1<<(size-1)); break;
486
        case 5: axis = 1; layer =             1; break;
487
        case 6: axis = 2; layer = (1<<(size-1)); break;
488
        case 7: axis = 0; layer =             1; break;
489
        }
490
491 a4962b9c Leszek Koltunski
      return CUBITS[cubit].mRotationRow[axis] == layer ? cubitface : NUM_TEXTURES;
492 680f921e Leszek Koltunski
      }
493
    else
494
      {
495 a4962b9c Leszek Koltunski
      return cubitface>0 ? NUM_TEXTURES : retFaceTetraBelongsTo(cubit-numO, size);
496 680f921e Leszek Koltunski
      }
497 ece1b58d Leszek Koltunski
    }
498
499
///////////////////////////////////////////////////////////////////////////////////////////////////
500
501 9c06394a Leszek Koltunski
  int getColor(int face)
502 ece1b58d Leszek Koltunski
    {
503 9c06394a Leszek Koltunski
    return FACE_COLORS[face];
504
    }
505
506
///////////////////////////////////////////////////////////////////////////////////////////////////
507 76c2bd07 Leszek Koltunski
508 9c06394a Leszek Koltunski
  ObjectSticker retSticker(int face)
509
    {
510
    return mStickers[face/NUM_FACES];
511 ece1b58d Leszek Koltunski
    }
512
513
///////////////////////////////////////////////////////////////////////////////////////////////////
514
515
  float returnMultiplier()
516
    {
517 cc99cf91 Leszek Koltunski
    return 1.5f;
518 ece1b58d Leszek Koltunski
    }
519
520
///////////////////////////////////////////////////////////////////////////////////////////////////
521
// PUBLIC API
522
523
  public Static3D[] getRotationAxis()
524
    {
525
    return ROT_AXIS;
526
    }
527
528
///////////////////////////////////////////////////////////////////////////////////////////////////
529
530 925ed78f Leszek Koltunski
  public int[] getBasicAngle()
531 ece1b58d Leszek Koltunski
    {
532 925ed78f Leszek Koltunski
    return BASIC_ANGLE;
533 ece1b58d Leszek Koltunski
    }
534
535
///////////////////////////////////////////////////////////////////////////////////////////////////
536
537 486b3417 Leszek Koltunski
  public void randomizeNewScramble(int[][] scramble, Random rnd, int curr, int totalScrambles)
538 ece1b58d Leszek Koltunski
    {
539 9f171eba Leszek Koltunski
    if( curr==0 )
540 ece1b58d Leszek Koltunski
      {
541 486b3417 Leszek Koltunski
      mCurrState     = 0;
542
      mIndexExcluded =-1;
543 ece1b58d Leszek Koltunski
      }
544
545 486b3417 Leszek Koltunski
    int total = mStates[mCurrState].getTotal(mIndexExcluded);
546
    int random= rnd.nextInt(total);
547
    int[] info= mStates[mCurrState].getInfo(random,mIndexExcluded);
548 ece1b58d Leszek Koltunski
549 486b3417 Leszek Koltunski
    scramble[curr][0] = info[0];
550
    scramble[curr][1] = info[1];
551
    scramble[curr][2] = info[2];
552 ece1b58d Leszek Koltunski
553 486b3417 Leszek Koltunski
    mCurrState     = info[3];
554
    mIndexExcluded = info[0];
555 ece1b58d Leszek Koltunski
    }
556
557 6fd4a72c Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
558
559
  public int getObjectName(int numLayers)
560
    {
561 2ef489e2 Leszek Koltunski
    switch(numLayers)
562
      {
563
      case 2: return R.string.diam2;
564
      case 3: return R.string.diam3;
565 2adf1263 Leszek Koltunski
      case 4: return R.string.diam4;
566 2ef489e2 Leszek Koltunski
      }
567
568
    return 0;
569 6fd4a72c Leszek Koltunski
    }
570
571
///////////////////////////////////////////////////////////////////////////////////////////////////
572
573
  public int getInventor(int numLayers)
574
    {
575 2ef489e2 Leszek Koltunski
    switch(numLayers)
576
      {
577
      case 2: return R.string.diam2_inventor;
578
      case 3: return R.string.diam3_inventor;
579 2adf1263 Leszek Koltunski
      case 4: return R.string.diam4_inventor;
580 2ef489e2 Leszek Koltunski
      }
581
582
    return 0;
583 6fd4a72c Leszek Koltunski
    }
584
585
///////////////////////////////////////////////////////////////////////////////////////////////////
586
587
  public int getComplexity(int numLayers)
588
    {
589 2ef489e2 Leszek Koltunski
    switch(numLayers)
590
      {
591 2adf1263 Leszek Koltunski
      case 2: return 4;
592
      case 3: return 6;
593
      case 4: return 8;
594 2ef489e2 Leszek Koltunski
      }
595
596
    return 0;
597 6fd4a72c Leszek Koltunski
    }
598 ece1b58d Leszek Koltunski
}