Project

General

Profile

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

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

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