Project

General

Profile

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

magiccube / src / main / java / org / distorted / objects / TwistyMinx.java @ 47d98cd5

1
///////////////////////////////////////////////////////////////////////////////////////////////////
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
import org.distorted.helpers.FactoryCubit;
25
import org.distorted.library.main.DistortedEffects;
26
import org.distorted.library.main.DistortedTexture;
27
import org.distorted.library.mesh.MeshBase;
28
import org.distorted.library.mesh.MeshSquare;
29
import org.distorted.library.type.Static3D;
30
import org.distorted.library.type.Static4D;
31

    
32
import java.util.Random;
33

    
34
///////////////////////////////////////////////////////////////////////////////////////////////////
35

    
36
abstract class TwistyMinx extends TwistyObject
37
{
38
  private static final int FACES_PER_CUBIT =6;
39

    
40
  static final int NUM_CORNERS = 20;
41
  static final int NUM_CENTERS = 12;
42
  static final int NUM_EDGES   = 30;
43

    
44
  static final float C2       = (SQ5+3)/4;
45
  static final float LEN      = (float)(Math.sqrt(1.25f+0.5f*SQ5));
46
  static final float SIN54    = (SQ5+1)/4;
47
  static final float COS54    = (float)(Math.sqrt(10-2*SQ5)/4);
48
  static final float SIN18    = (SQ5-1)/4;
49
  static final float COS18    = (float)(0.25f*Math.sqrt(10.0f+2.0f*SQ5));
50
  static final float COS_HALFD= (float)(Math.sqrt(0.5f-0.1f*SQ5)); // cos(half the dihedral angle)
51
  static final float SIN_HALFD= (float)(Math.sqrt(0.5f+0.1f*SQ5)); // sin(half the dihedral angle)
52

    
53
  // the six rotation axis of a Minx. Must be normalized.
54
  static final Static3D[] ROT_AXIS = new Static3D[]
55
         {
56
           new Static3D(    C2/LEN, SIN54/LEN,    0      ),
57
           new Static3D(   -C2/LEN, SIN54/LEN,    0      ),
58
           new Static3D( 0        ,    C2/LEN, SIN54/LEN ),
59
           new Static3D( 0        ,   -C2/LEN, SIN54/LEN ),
60
           new Static3D( SIN54/LEN,    0     ,    C2/LEN ),
61
           new Static3D( SIN54/LEN,    0     ,   -C2/LEN )
62
         };
63

    
64
  private static final int[] BASIC_ANGLE = new int[] { 5,5,5,5,5,5 };
65

    
66
  static final int MINX_LGREEN = 0xff53aa00;
67
  static final int MINX_PINK   = 0xfffd7ab7;
68
  static final int MINX_SANDY  = 0xffefd48b;
69
  static final int MINX_LBLUE  = 0xff00a2d7;
70
  static final int MINX_ORANGE = 0xffff6200;
71
  static final int MINX_VIOLET = 0xff7d59a4;
72
  static final int MINX_DGREEN = 0xff007a47;
73
  static final int MINX_DRED   = 0xffbd0000;
74
  static final int MINX_DBLUE  = 0xff1a29b2;
75
  static final int MINX_DYELLOW= 0xffffc400;
76
  static final int MINX_WHITE  = 0xffffffff;
77
  static final int MINX_GREY   = 0xff727c7b;
78

    
79
  static final int[] FACE_COLORS = new int[]
80
         {
81
           MINX_LGREEN, MINX_PINK   , MINX_SANDY , MINX_LBLUE,
82
           MINX_ORANGE, MINX_VIOLET , MINX_DGREEN, MINX_DRED ,
83
           MINX_DBLUE , MINX_DYELLOW, MINX_WHITE , MINX_GREY
84
         };
85

    
86
  // All 60 legal rotation quats of a Minx
87
  static final Static4D[] QUATS = new Static4D[]
88
         {
89
           new Static4D(  0.0f,  0.0f,  0.0f,  1.0f ),  //0
90
           new Static4D(  1.0f,  0.0f,  0.0f,  0.0f ),
91
           new Static4D(  0.0f,  1.0f,  0.0f,  0.0f ),
92
           new Static4D(  0.0f,  0.0f,  1.0f,  0.0f ),
93

    
94
           new Static4D(  0.5f,  0.5f,  0.5f,  0.5f ),  //4
95
           new Static4D(  0.5f,  0.5f, -0.5f,  0.5f ),
96
           new Static4D(  0.5f, -0.5f,  0.5f,  0.5f ),
97
           new Static4D(  0.5f, -0.5f, -0.5f,  0.5f ),
98
           new Static4D( -0.5f,  0.5f,  0.5f,  0.5f ),
99
           new Static4D( -0.5f,  0.5f, -0.5f,  0.5f ),
100
           new Static4D( -0.5f, -0.5f,  0.5f,  0.5f ),
101
           new Static4D( -0.5f, -0.5f, -0.5f,  0.5f ),
102

    
103
           new Static4D(  0.5f, SIN54, SIN18,  0.0f ), // 12
104
           new Static4D(  0.5f, SIN54,-SIN18,  0.0f ),
105
           new Static4D(  0.5f,-SIN54, SIN18,  0.0f ),
106
           new Static4D(  0.5f,-SIN54,-SIN18,  0.0f ),
107
           new Static4D( SIN18,  0.5f, SIN54,  0.0f ),
108
           new Static4D( SIN18,  0.5f,-SIN54,  0.0f ),
109
           new Static4D(-SIN18,  0.5f, SIN54,  0.0f ),
110
           new Static4D(-SIN18,  0.5f,-SIN54,  0.0f ),
111
           new Static4D( SIN54, SIN18,  0.5f,  0.0f ),
112
           new Static4D( SIN54,-SIN18,  0.5f,  0.0f ),
113
           new Static4D(-SIN54, SIN18,  0.5f,  0.0f ),
114
           new Static4D(-SIN54,-SIN18,  0.5f,  0.0f ),
115

    
116
           new Static4D(  0.0f, SIN18, SIN54,  0.5f ), //24
117
           new Static4D(  0.0f, SIN18,-SIN54,  0.5f ),
118
           new Static4D(  0.0f,-SIN18, SIN54,  0.5f ),
119
           new Static4D(  0.0f,-SIN18,-SIN54,  0.5f ),
120
           new Static4D( SIN18, SIN54,  0.0f,  0.5f ),
121
           new Static4D( SIN18,-SIN54,  0.0f,  0.5f ),
122
           new Static4D(-SIN18, SIN54,  0.0f,  0.5f ),
123
           new Static4D(-SIN18,-SIN54,  0.0f,  0.5f ),
124
           new Static4D( SIN54,  0.0f, SIN18,  0.5f ),
125
           new Static4D( SIN54,  0.0f,-SIN18,  0.5f ),
126
           new Static4D(-SIN54,  0.0f, SIN18,  0.5f ),
127
           new Static4D(-SIN54,  0.0f,-SIN18,  0.5f ),
128

    
129
           new Static4D(  0.0f, SIN54,  0.5f, SIN18 ), //36
130
           new Static4D(  0.0f, SIN54, -0.5f, SIN18 ),
131
           new Static4D(  0.0f,-SIN54,  0.5f, SIN18 ),
132
           new Static4D(  0.0f,-SIN54, -0.5f, SIN18 ),
133
           new Static4D(  0.5f,  0.0f, SIN54, SIN18 ),
134
           new Static4D(  0.5f,  0.0f,-SIN54, SIN18 ),
135
           new Static4D( -0.5f,  0.0f, SIN54, SIN18 ),
136
           new Static4D( -0.5f,  0.0f,-SIN54, SIN18 ),
137
           new Static4D( SIN54,  0.5f,  0.0f, SIN18 ),
138
           new Static4D( SIN54, -0.5f,  0.0f, SIN18 ),
139
           new Static4D(-SIN54,  0.5f,  0.0f, SIN18 ),
140
           new Static4D(-SIN54, -0.5f,  0.0f, SIN18 ),
141

    
142
           new Static4D(  0.0f,  0.5f, SIN18, SIN54 ), //48
143
           new Static4D(  0.0f,  0.5f,-SIN18, SIN54 ),
144
           new Static4D(  0.0f, -0.5f, SIN18, SIN54 ),
145
           new Static4D(  0.0f, -0.5f,-SIN18, SIN54 ),
146
           new Static4D(  0.5f, SIN18,  0.0f, SIN54 ),
147
           new Static4D(  0.5f,-SIN18,  0.0f, SIN54 ),
148
           new Static4D( -0.5f, SIN18,  0.0f, SIN54 ),
149
           new Static4D( -0.5f,-SIN18,  0.0f, SIN54 ),
150
           new Static4D( SIN18,  0.0f,  0.5f, SIN54 ),
151
           new Static4D( SIN18,  0.0f, -0.5f, SIN54 ),
152
           new Static4D(-SIN18,  0.0f,  0.5f, SIN54 ),
153
           new Static4D(-SIN18,  0.0f, -0.5f, SIN54 ),
154
         };
155

    
156
  // Coordinates of all 20 corners of a Minx
157
  static final float[][] CORNERS = new float[][]
158
         {
159
             {  0.0f,  0.5f,    C2},
160
             {  0.0f,  0.5f,   -C2},
161
             {  0.0f, -0.5f,    C2},
162
             {  0.0f, -0.5f,   -C2},
163
             {    C2,  0.0f,  0.5f},
164
             {    C2,  0.0f, -0.5f},
165
             {   -C2,  0.0f,  0.5f},
166
             {   -C2,  0.0f, -0.5f},
167
             {  0.5f,    C2,  0.0f},
168
             {  0.5f,   -C2,  0.0f},
169
             { -0.5f,    C2,  0.0f},
170
             { -0.5f,   -C2,  0.0f},
171
             { SIN54, SIN54, SIN54},
172
             { SIN54, SIN54,-SIN54},
173
             { SIN54,-SIN54, SIN54},
174
             { SIN54,-SIN54,-SIN54},
175
             {-SIN54, SIN54, SIN54},
176
             {-SIN54, SIN54,-SIN54},
177
             {-SIN54,-SIN54, SIN54},
178
             {-SIN54,-SIN54,-SIN54},
179
         };
180

    
181
  static final int[][] mCornerFaceMap =
182
         {
183
           {  0, 1, 8 },
184
           {  6, 5,10 },
185
           {  1, 0,11 },
186
           {  5, 6, 3 },
187
           {  0, 9, 4 },
188
           {  5, 4, 9 },
189
           {  7, 1, 2 },
190
           {  2, 6, 7 },
191
           { 10, 9, 8 },
192
           {  4, 3,11 },
193
           {  7,10, 8 },
194
           {  3, 2,11 },
195
           {  0, 8, 9 },
196
           {  9,10, 5 },
197
           {  0, 4,11 },
198
           {  4, 5, 3 },
199
           {  1, 7, 8 },
200
           {  7, 6,10 },
201
           {  2, 1,11 },
202
           {  6, 2, 3 },
203
         };
204

    
205
  static final int[] QUAT_EDGE_INDICES =
206
      {
207
        56, 40, 43, 59,  0, 19,  9, 54, 58, 49,
208
        48, 24, 52,  4, 16, 32, 20, 11, 21, 35 ,
209
        37, 30,  8, 28, 36, 44,  1, 46, 12, 47
210
      };
211

    
212

    
213
  static final int[] QUAT_CORNER_INDICES =
214
      {
215
         0,  2,  3,  1, 40, 31, 41, 30, 39, 35,
216
        36, 34, 56, 32, 43, 21, 48, 28, 42, 23
217
      };
218

    
219
  static final boolean[][] OPPOSITE_ROWS =
220
      {
221
          {false,  true, false,  true, false, false},
222
          { true, false, false,  true,  true,  true},
223
          {false, false, false,  true, false,  true},
224
          { true,  true,  true, false, false,  true},
225
          {false,  true, false, false, false,  true},
226
          {false,  true,  true,  true,  true, false}
227
      };
228

    
229
  // the quadruple ( corner1, corner2, face1, face2 ) defining an edge.
230
  // In fact the 2 corners already define it, the faces only provide easy
231
  // way to get to know the colors. Order: arbitrary. Face1 arbitrarily on
232
  // the 'left' or right of vector corner1 --> corner2, according to Quat.
233
  static final int[][] mEdgeMap =
234
         {
235
           {  0, 12,  0,  8}, //0
236
           { 12,  4,  0,  9},
237
           {  4, 14,  0,  4},
238
           { 14,  2,  0, 11},
239
           {  2,  0,  0,  1},
240
           { 14,  9, 11,  4}, //5
241
           {  9, 11, 11,  3},
242
           { 11, 18, 11,  2},
243
           { 18,  2, 11,  1},
244
           { 18,  6,  1,  2},
245
           {  6, 16,  1,  7}, //10
246
           { 16,  0,  1,  8},
247
           { 16, 10,  8,  7},
248
           { 10,  8,  8, 10},
249
           {  8, 12,  8,  9},
250
           {  8, 13,  9, 10}, //15
251
           { 13,  5,  9,  5},
252
           {  5,  4,  9,  4},
253
           {  5, 15,  4,  5},
254
           { 15,  9,  4,  3},
255
           { 11, 19,  2,  3}, //20
256
           { 19,  7,  2,  6},
257
           {  7,  6,  2,  7},
258
           {  7, 17,  7,  6},
259
           { 17, 10,  7, 10},
260
           { 17,  1, 10,  6}, //25
261
           {  1,  3,  5,  6},
262
           {  3, 19,  3,  6},
263
           {  1, 13, 10,  5},
264
           {  3, 15,  5,  3},
265
         };
266

    
267
  // the five vertices that form a given face. Order: the same as colors
268
  // of the faces in TwistyMinx.
269
  static final int[][] mCenterMap =
270
         {
271
           { 0, 12,  4, 14,  2},
272
           { 0,  2, 18,  6, 16},
273
           { 6, 18, 11, 19,  7},
274
           { 3, 15,  9, 11, 19},
275
           { 4,  5, 15,  9, 14},
276
           { 1, 13,  5, 15,  3},
277
           { 1,  3, 19,  7, 17},
278
           {10, 16,  6,  7, 17},
279
           { 0, 12,  8, 10, 16},
280
           { 8, 13,  5,  4, 12},
281
           { 1, 13,  8, 10, 17},
282
           { 2, 14,  9, 11, 18},
283
         };
284

    
285
  static final float[][] mCenterCoords = new float[NUM_CENTERS][3];
286

    
287
  static
288
    {
289
    for(int center=0; center<NUM_CENTERS; center++)
290
      {
291
      int[] map = mCenterMap[center];
292

    
293
      float x = CORNERS[map[0]][0] +
294
                CORNERS[map[1]][0] +
295
                CORNERS[map[2]][0] +
296
                CORNERS[map[3]][0] +
297
                CORNERS[map[4]][0] ;
298

    
299
      float y = CORNERS[map[0]][1] +
300
                CORNERS[map[1]][1] +
301
                CORNERS[map[2]][1] +
302
                CORNERS[map[3]][1] +
303
                CORNERS[map[4]][1] ;
304

    
305
      float z = CORNERS[map[0]][2] +
306
                CORNERS[map[1]][2] +
307
                CORNERS[map[2]][2] +
308
                CORNERS[map[3]][2] +
309
                CORNERS[map[4]][2] ;
310

    
311
      mCenterCoords[center][0] = x/5;
312
      mCenterCoords[center][1] = y/5;
313
      mCenterCoords[center][2] = z/5;
314
      }
315
    }
316

    
317
  static final Static4D[] mBasicCornerV, mCurrCornerV;
318

    
319
  static
320
    {
321
    mBasicCornerV = new Static4D[3];
322
    mCurrCornerV  = new Static4D[3];
323

    
324
    mBasicCornerV[0] = new Static4D( (SQ5+1)*0.125f, (SQ5-1)*0.125f, -0.250f, 0.0f );
325
    mBasicCornerV[1] = new Static4D(-(SQ5+1)*0.125f, (SQ5-1)*0.125f, -0.250f, 0.0f );
326
    mBasicCornerV[2] = new Static4D(              0,        -0.500f,    0.0f, 0.0f );
327
    }
328

    
329
  private static int[][] mScrambleTable;
330
  private static int[] mPossibleAxis, mPossibleLayers;
331
  private static int[] mNumOccurences;
332

    
333
///////////////////////////////////////////////////////////////////////////////////////////////////
334

    
335
  TwistyMinx(int numLayers, int realSize, Static4D quat, DistortedTexture texture, MeshSquare mesh,
336
             DistortedEffects effects, int[][] moves, ObjectList obj, Resources res, int scrWidth)
337
    {
338
    super(numLayers, realSize, quat, texture, mesh, effects, moves, obj, res, scrWidth);
339
    }
340

    
341
///////////////////////////////////////////////////////////////////////////////////////////////////
342

    
343
  Static4D[] getQuats()
344
    {
345
    return QUATS;
346
    }
347

    
348
///////////////////////////////////////////////////////////////////////////////////////////////////
349

    
350
  int getNumFaces()
351
    {
352
    return FACE_COLORS.length;
353
    }
354

    
355
///////////////////////////////////////////////////////////////////////////////////////////////////
356

    
357
  boolean shouldResetTextureMaps()
358
    {
359
    return false;
360
    }
361

    
362
///////////////////////////////////////////////////////////////////////////////////////////////////
363

    
364
  int getNumCubitFaces()
365
    {
366
    return FACES_PER_CUBIT;
367
    }
368

    
369
///////////////////////////////////////////////////////////////////////////////////////////////////
370

    
371
  float returnMultiplier()
372
    {
373
    return 2.0f;
374
    }
375

    
376
///////////////////////////////////////////////////////////////////////////////////////////////////
377

    
378
  MeshBase createCornerMesh(int numLayers, float width)
379
    {
380
    float A = (2*SQ3/3)*SIN54;
381
    float B = 0.4f;
382
    int   N = numLayers==3 ? 5 : 3;
383
    int   E1= numLayers==3 ? 1 : 0;
384
    int   E2= numLayers==3 ? 3 : 0;
385

    
386
    double X = width*COS18*SIN_HALFD;
387
    double Y = width*SIN18;
388
    double Z = width*COS18*COS_HALFD;
389

    
390
    double[][] vertices = new double[][]
391
        {
392
            { 0.0, 0.0      , 0.0 },
393
            {   X,   Y      ,  -Z },
394
            { 0.0, 2*Y      ,-2*Z },
395
            {  -X,   Y      ,  -Z },
396
            { 0.0, 0.0-width, 0.0 },
397
            {   X,   Y-width,  -Z },
398
            { 0.0, 2*Y-width,-2*Z },
399
            {  -X,   Y-width,  -Z },
400
        };
401

    
402
    int[][] vertIndexes = new int[][]
403
        {
404
            {4,5,1,0},
405
            {7,4,0,3},
406
            {0,1,2,3},
407
            {4,5,6,7},
408
            {6,5,1,2},
409
            {7,6,2,3}
410
        };
411

    
412
    float[][] bands     = new float[][]
413
      {
414
         {0.04f,34,0.3f,0.2f, N, 1, E1},
415
         {0.00f, 0,0.0f,0.0f, 2, 1, E2}
416
      };
417
    int[] bandIndexes   = new int[] { 0,0,0,1,1,1};
418
    float[][] corners   = new float[][] { {0.04f,0.10f} };
419
    int[] cornerIndexes = new int[] { 0,-1,-1,-1,-1,-1,-1,-1 };
420
    float[][] centers   = new float[][] { {0.0f, -(float)Math.sqrt(1-A*A)*B,-A*B} };
421
    int[] centerIndexes = new int[] { 0,-1,-1,-1,-1,-1,-1,-1 };
422

    
423
    FactoryCubit factory = FactoryCubit.getInstance();
424
    factory.createNewFaceTransform(vertices,vertIndexes);
425

    
426
    return factory.createRoundedSolid(vertices, vertIndexes,
427
                                      bands, bandIndexes,
428
                                      corners, cornerIndexes,
429
                                      centers, centerIndexes,
430
                                      getNumCubitFaces(), null );
431
    }
432

    
433
///////////////////////////////////////////////////////////////////////////////////////////////////
434

    
435
  private void initializeScrambleTable(int[] first, int numLayers)
436
    {
437
    if( mScrambleTable ==null ) mScrambleTable = new int[NUM_AXIS][2];
438
    if( mPossibleAxis  ==null ) mPossibleAxis  = new int[NUM_AXIS-1];
439
    if( mPossibleLayers==null ) mPossibleLayers= new int[NUM_AXIS-1];
440
    if( mNumOccurences ==null ) mNumOccurences = new int[NUM_AXIS-1];
441

    
442
    for(int i=0; i<NUM_AXIS; i++)
443
      for(int j=0; j<2; j++)
444
        {
445
        mScrambleTable[i][j] = 0;
446
        }
447

    
448
    int layer = convertRowIntoLayer(first[1],numLayers);
449

    
450
    mScrambleTable[first[0]][layer] = 1;
451
    }
452

    
453
///////////////////////////////////////////////////////////////////////////////////////////////////
454

    
455
  private int convertRowIntoLayer(int row, int numLayers)
456
    {
457
    return row>(numLayers-1)/2 ? 1 : 0;
458
    }
459

    
460
///////////////////////////////////////////////////////////////////////////////////////////////////
461

    
462
  private int convertLayerIntoRow(Random rnd, int layer, int numLayers)
463
    {
464
    int ran = numLayers>3 ? rnd.nextInt((numLayers-1)/2) : 0;
465
    return layer==0 ? ran : numLayers-1-ran;
466
    }
467

    
468
///////////////////////////////////////////////////////////////////////////////////////////////////
469

    
470
  private boolean areOpposite(int oldAxis, int newAxis, int oldRow, int nom)
471
    {
472
    return OPPOSITE_ROWS[oldAxis][newAxis]^(oldRow<nom);
473
    }
474

    
475
///////////////////////////////////////////////////////////////////////////////////////////////////
476

    
477
  private int retNewRotationIndex(Random rnd, int nom, int[] oldRot)
478
    {
479
    int index=0, max=0;
480

    
481
    for(int ax=0; ax<NUM_AXIS; ax++)
482
      {
483
      if( ax!=oldRot[0] )
484
        {
485
        mPossibleAxis[index] = ax;
486
        mPossibleLayers[index] = areOpposite(oldRot[0],ax,oldRot[1],nom) ? 0:1;
487
        int tmp = mScrambleTable[mPossibleAxis[index]][mPossibleLayers[index]];
488
        if( tmp>max ) max=tmp;
489
        index++;
490
        }
491
      }
492

    
493
    for(int ax=0; ax<NUM_AXIS-1; ax++)
494
      {
495
      int value = mScrambleTable[mPossibleAxis[ax]][mPossibleLayers[ax]];
496
      mNumOccurences[ax] = max - value + (ax==0 ? 0 : mNumOccurences[ax-1]);
497
      }
498

    
499
    float random= rnd.nextFloat()*mNumOccurences[NUM_AXIS-2];
500

    
501
    for(int ax=0; ax<NUM_AXIS-1; ax++)
502
      {
503
      if( random <= mNumOccurences[ax] )
504
        {
505
        index=ax;
506
        break;
507
        }
508
      }
509

    
510
    mScrambleTable[mPossibleAxis[index]][mPossibleLayers[index]]++;
511

    
512
    return index;
513
    }
514

    
515
///////////////////////////////////////////////////////////////////////////////////////////////////
516
// PUBLIC API
517

    
518
  public void randomizeNewScramble(int[][] scramble, Random rnd, int curr, int total)
519
    {
520
    int numLayers = getNumLayers();
521
    int nom = (numLayers-1)/2;
522

    
523
    if( curr==0 )
524
      {
525
      int lf = rnd.nextInt(2);
526
      int row= rnd.nextInt(nom);
527
      scramble[curr][0] = rnd.nextInt(NUM_AXIS);
528
      scramble[curr][1] = (lf==0 ? row : numLayers-1-row);
529
      initializeScrambleTable(scramble[curr],numLayers);
530
      }
531
    else
532
      {
533
      int index = retNewRotationIndex(rnd,nom,scramble[curr-1]);
534
      scramble[curr][0] = mPossibleAxis[index];
535
      scramble[curr][1] = convertLayerIntoRow(rnd, mPossibleLayers[index], numLayers);
536
      }
537

    
538
    switch( rnd.nextInt(4) )
539
      {
540
      case 0: scramble[curr][2] = -2; break;
541
      case 1: scramble[curr][2] = -1; break;
542
      case 2: scramble[curr][2] =  1; break;
543
      case 3: scramble[curr][2] =  2; break;
544
      }
545
    }
546

    
547
///////////////////////////////////////////////////////////////////////////////////////////////////
548

    
549
  public Static3D[] getRotationAxis()
550
    {
551
    return ROT_AXIS;
552
    }
553

    
554
///////////////////////////////////////////////////////////////////////////////////////////////////
555

    
556
  public int[] getBasicAngle()
557
    {
558
    return BASIC_ANGLE;
559
    }
560
}
(32-32/41)