Project

General

Profile

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

magiccube / src / main / java / org / distorted / objects / TwistySkewb.java @ 01b2ef5a

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.ObjectShape;
25
import org.distorted.helpers.ObjectSticker;
26
import org.distorted.helpers.ScrambleStateGraph;
27
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
import org.distorted.main.R;
33

    
34
import java.util.Random;
35

    
36
///////////////////////////////////////////////////////////////////////////////////////////////////
37

    
38
public class TwistySkewb extends TwistyObject
39
{
40
  private static final int FACES_PER_CUBIT =6;
41

    
42
  // the four rotation axis of a RubikSkewb. Must be normalized.
43
  static final Static3D[] ROT_AXIS = new Static3D[]
44
         {
45
           new Static3D(+SQ3/3,+SQ3/3,+SQ3/3),
46
           new Static3D(+SQ3/3,+SQ3/3,-SQ3/3),
47
           new Static3D(+SQ3/3,-SQ3/3,+SQ3/3),
48
           new Static3D(+SQ3/3,-SQ3/3,-SQ3/3)
49
         };
50

    
51
  private static final int[] BASIC_ANGLE = new int[] { 3,3,3,3 };
52

    
53
  private static final int[] FACE_COLORS = new int[]
54
         {
55
           COLOR_YELLOW, COLOR_WHITE,
56
           COLOR_BLUE  , COLOR_GREEN,
57
           COLOR_RED   , COLOR_ORANGE
58
         };
59

    
60
  // All legal rotation quats of a RubikSkewb
61
  private static final Static4D[] QUATS = new Static4D[]
62
         {
63
           new Static4D(  0.0f,  0.0f,  0.0f,  1.0f ),
64
           new Static4D(  1.0f,  0.0f,  0.0f,  0.0f ),
65
           new Static4D(  0.0f,  1.0f,  0.0f,  0.0f ),
66
           new Static4D(  0.0f,  0.0f,  1.0f,  0.0f ),
67

    
68
           new Static4D(  0.5f,  0.5f,  0.5f,  0.5f ),
69
           new Static4D(  0.5f,  0.5f,  0.5f, -0.5f ),
70
           new Static4D(  0.5f,  0.5f, -0.5f,  0.5f ),
71
           new Static4D(  0.5f,  0.5f, -0.5f, -0.5f ),
72
           new Static4D(  0.5f, -0.5f,  0.5f,  0.5f ),
73
           new Static4D(  0.5f, -0.5f,  0.5f, -0.5f ),
74
           new Static4D(  0.5f, -0.5f, -0.5f,  0.5f ),
75
           new Static4D(  0.5f, -0.5f, -0.5f, -0.5f )
76
         };
77

    
78
  private static final int[][] mCornerMap =
79
         {
80
           {  4, 2, 0, 18,18,18 },
81
           {  2, 5, 0, 18,18,18 },
82
           {  3, 4, 0, 18,18,18 },
83
           {  5, 3, 0, 18,18,18 },
84
           {  1, 2, 4, 18,18,18 },
85
           {  5, 2, 1, 18,18,18 },
86
           {  4, 3, 1, 18,18,18 },
87
           {  1, 3, 5, 18,18,18 },
88
         };
89

    
90
  private static final int[][] mEdgeMap =
91
         {
92
           { 10, 8, 18,18,18,18 },
93
           {  6,10, 18,18,18,18 },
94
           { 10, 9, 18,18,18,18 },
95
           {  7,10, 18,18,18,18 },
96
           {  8, 6, 18,18,18,18 },
97
           {  9, 6, 18,18,18,18 },
98
           {  9, 7, 18,18,18,18 },
99
           {  8, 7, 18,18,18,18 },
100
           { 11, 8, 18,18,18,18 },
101
           {  6,11, 18,18,18,18 },
102
           { 11, 9, 18,18,18,18 },
103
           {  7,11, 18,18,18,18 }
104
         };
105

    
106
  private static final int[][] mCenterMap =
107
         {
108
           { 12, 18,18,18,18,18 },
109
           { 13, 18,18,18,18,18 },
110
           { 14, 18,18,18,18,18 },
111
           { 15, 18,18,18,18,18 },
112
           { 16, 18,18,18,18,18 },
113
           { 17, 18,18,18,18,18 },
114
         };
115

    
116
  private static final double[][] VERTICES_CORNER = new double[][]
117
          {
118
              {-0.5f, 0.0f, 0.0f},
119
              { 0.0f,-0.5f, 0.0f},
120
              { 0.0f, 0.0f,-0.5f},
121
              {-0.5f,-0.5f,-0.5f},
122
              { 0.0f, 0.0f, 0.0f}
123
          };
124

    
125
  private static final int[][] VERT_INDEXES_CORNER = new int[][]
126
          {
127
              {0,1,4},
128
              {2,0,4},
129
              {1,2,4},
130
              {3,1,0},
131
              {3,2,1},
132
              {3,0,2}
133
          };
134

    
135
  private static final double[][] VERTICES_EDGE = new double[][]
136
          {
137
             {-0.5, 0.0, 0.0},
138
             { 0.5, 0.0, 0.0},
139
             { 0.0,-0.5, 0.0},
140
             { 0.0, 0.0,-0.5}
141
          };
142

    
143
  private static final int[][] VERT_INDEXES_EDGE = new int[][]
144
          {
145
             {2,1,0},   // counterclockwise!
146
             {3,0,1},
147
             {2,3,1},
148
             {3,2,0},
149
          };
150

    
151
  private static final double[][] VERTICES_FACE = new double[][]
152
          {
153
             {-0.5f, 0.0f, 0.0f },
154
             { 0.0f,-0.5f, 0.0f },
155
             { 0.5f, 0.0f, 0.0f },
156
             { 0.0f, 0.5f, 0.0f },
157
             { 0.0f, 0.0f,-0.5f }
158
          };
159

    
160
  private static final int[][] VERT_INDEXES_FACE = new int[][]
161
          {
162
             {0,1,2,3},
163
             {4,1,0},
164
             {4,2,1},
165
             {4,3,2},
166
             {4,0,3}
167
          };
168

    
169
  private static final float[][] STICKERS = new float[][]
170
          {
171
             { -0.5f, 0.25f, 0.25f,  -0.5f, 0.25f, 0.25f  },
172
             { -0.5f, 0.00f, 0.00f,  -0.5f, 0.50f, 0.0f, 0.0f, 0.5f }
173
          };
174

    
175
  private static final ObjectSticker[] mStickers;
176

    
177
  static
178
    {
179
    mStickers = new ObjectSticker[STICKERS.length+1];
180
    final float R1 = 0.025f;
181
    final float R2 = 0.025f;
182
    final float R3 = 0.055f;
183
    final float[][] radii  = { { R1,R1,R1 },{ R2,R2,R2 },{ R3,R3,R3,R3 } };
184
    final float[] strokes = { 0.045f, 0.035f, 0.035f };
185

    
186
    for(int s=0; s<STICKERS.length+1; s++)
187
      {
188
      int index = s<2 ? 0:1;
189
      mStickers[s] = new ObjectSticker(STICKERS[index],null,radii[s],strokes[s]);
190
      }
191
    }
192

    
193
  private int mCurrState;
194
  private int mIndexExcluded;
195
  private final ScrambleStateGraph[] mStates;
196

    
197
///////////////////////////////////////////////////////////////////////////////////////////////////
198

    
199
  TwistySkewb(int size, Static4D quat, DistortedTexture texture,
200
              MeshSquare mesh, DistortedEffects effects, int[][] moves, Resources res, int scrWidth)
201
    {
202
    super(size, 2*size-2, quat, texture, mesh, effects, moves, ObjectList.SKEW, res, scrWidth);
203

    
204
    int[] tmp = {0,-1,0, 0,1,0, size-1,-1,0, size-1,1,0 };
205

    
206
    mStates = new ScrambleStateGraph[]
207
      {
208
      new ScrambleStateGraph( new int[][] {tmp,tmp,tmp,tmp} )
209
      };
210
    }
211

    
212
///////////////////////////////////////////////////////////////////////////////////////////////////
213

    
214
  int[] getSolvedQuats(int cubit, int numLayers)
215
    {
216
    int status = retCubitSolvedStatus(cubit,numLayers);
217
    return status<0 ? null : buildSolvedQuats(MovementSkewb.FACE_AXIS[status],QUATS);
218
    }
219

    
220
///////////////////////////////////////////////////////////////////////////////////////////////////
221

    
222
  private int getNumCorners()
223
    {
224
    return 8;
225
    }
226

    
227
///////////////////////////////////////////////////////////////////////////////////////////////////
228

    
229
  private int getNumEdges(int layers)
230
    {
231
    return (layers-2)*12;
232
    }
233

    
234
///////////////////////////////////////////////////////////////////////////////////////////////////
235

    
236
  private int getNumCentersPerFace(int layers)
237
    {
238
    return ((layers-2)*(layers-2) + (layers-1)*(layers-1));
239
    }
240

    
241
///////////////////////////////////////////////////////////////////////////////////////////////////
242

    
243
  float getScreenRatio()
244
    {
245
    return 1.0f;
246
    }
247

    
248
///////////////////////////////////////////////////////////////////////////////////////////////////
249

    
250
  Static4D[] getQuats()
251
    {
252
    return QUATS;
253
    }
254

    
255
///////////////////////////////////////////////////////////////////////////////////////////////////
256

    
257
  int getNumFaces()
258
    {
259
    return FACE_COLORS.length;
260
    }
261

    
262
///////////////////////////////////////////////////////////////////////////////////////////////////
263

    
264
  int getSolvedFunctionIndex()
265
    {
266
    return 0;
267
    }
268

    
269
///////////////////////////////////////////////////////////////////////////////////////////////////
270

    
271
  boolean shouldResetTextureMaps()
272
    {
273
    return false;
274
    }
275

    
276
///////////////////////////////////////////////////////////////////////////////////////////////////
277

    
278
  int getNumStickerTypes(int numLayers)
279
    {
280
    return 3;
281
    }
282

    
283
///////////////////////////////////////////////////////////////////////////////////////////////////
284

    
285
  float[][] getCuts(int numLayers)
286
    {
287
    switch(numLayers)
288
      {
289
      case 2: float[] c2 = new float[] {0.0f};
290
              return new float[][] { c2,c2,c2,c2 };
291
      case 3: float[] c3 = new float[] {-SQ3/12,+SQ3/12};
292
              return new float[][] { c3,c3,c3,c3 };
293
      }
294
    return null;
295
    }
296

    
297
///////////////////////////////////////////////////////////////////////////////////////////////////
298

    
299
  int getNumCubitFaces()
300
    {
301
    return FACES_PER_CUBIT;
302
    }
303

    
304
///////////////////////////////////////////////////////////////////////////////////////////////////
305

    
306
  float[][] getCubitPositions(int numLayers)
307
    {
308
    final float DIST_CORNER = (numLayers-1)*0.50f;
309
    final float DIST_EDGE   = (numLayers-1)*0.50f;
310
    final float DIST_CENTER = (numLayers-1)*0.50f;
311

    
312
    final int numCorners = getNumCorners();
313
    final int numEdges   = getNumEdges(numLayers);
314
    final int numCenters = 6*getNumCentersPerFace(numLayers);
315

    
316
    final float[][] CENTERS = new float[numCorners+numEdges+numCenters][];
317

    
318
    /// CORNERS //////////////////////////////////////////////
319

    
320
    CENTERS[0] = new float[] { DIST_CORNER, DIST_CORNER, DIST_CORNER };
321
    CENTERS[1] = new float[] { DIST_CORNER, DIST_CORNER,-DIST_CORNER };
322
    CENTERS[2] = new float[] { DIST_CORNER,-DIST_CORNER, DIST_CORNER };
323
    CENTERS[3] = new float[] { DIST_CORNER,-DIST_CORNER,-DIST_CORNER };
324
    CENTERS[4] = new float[] {-DIST_CORNER, DIST_CORNER, DIST_CORNER };
325
    CENTERS[5] = new float[] {-DIST_CORNER, DIST_CORNER,-DIST_CORNER };
326
    CENTERS[6] = new float[] {-DIST_CORNER,-DIST_CORNER, DIST_CORNER };
327
    CENTERS[7] = new float[] {-DIST_CORNER,-DIST_CORNER,-DIST_CORNER };
328

    
329
    /// EDGES ///////////////////////////////////////////////
330

    
331
    final float[][]  edgeTable =
332
        {
333
            {0,+DIST_EDGE,+DIST_EDGE},
334
            {+DIST_EDGE,0,+DIST_EDGE},
335
            {0,-DIST_EDGE,+DIST_EDGE},
336
            {-DIST_EDGE,0,+DIST_EDGE},
337
            {+DIST_EDGE,+DIST_EDGE,0},
338
            {+DIST_EDGE,-DIST_EDGE,0},
339
            {-DIST_EDGE,-DIST_EDGE,0},
340
            {-DIST_EDGE,+DIST_EDGE,0},
341
            {0,+DIST_EDGE,-DIST_EDGE},
342
            {+DIST_EDGE,0,-DIST_EDGE},
343
            {0,-DIST_EDGE,-DIST_EDGE},
344
            {-DIST_EDGE,0,-DIST_EDGE}
345
        };
346

    
347
    int index=8;
348

    
349
    for (float[] edges : edgeTable)
350
      {
351
      float c = (3-numLayers)*0.5f;
352

    
353
      for (int j=0; j<numLayers-2; j++, c+=1.0f, index++)
354
        {
355
        CENTERS[index] = new float[] { edges[0]==0 ? c : edges[0] ,
356
                                       edges[1]==0 ? c : edges[1] ,
357
                                       edges[2]==0 ? c : edges[2] };
358
        }
359
      }
360

    
361
    /// CENTERS //////////////////////////////////////////////
362

    
363
    final float X= -1000.0f;
364
    final float Y= -1001.0f;
365

    
366
    final float[][]  centerTable =
367
        {
368
            {+DIST_CENTER,X,Y},
369
            {-DIST_CENTER,X,Y},
370
            {X,+DIST_CENTER,Y},
371
            {X,-DIST_CENTER,Y},
372
            {X,Y,+DIST_CENTER},
373
            {X,Y,-DIST_CENTER}
374
        };
375

    
376
    float x,y, cen0, cen1, cen2;
377

    
378
    for( float[] centers : centerTable )
379
      {
380
      x = (2-numLayers)*0.5f;
381

    
382
      for(int i=0; i<numLayers-1; i++, x+=1.0f)
383
        {
384
        y = (2-numLayers)*0.5f;
385

    
386
        for(int j=0; j<numLayers-1; j++, y+=1.0f, index++)
387
          {
388
               if( centers[0]==Y ) cen0 = y;
389
          else if( centers[0]==X ) cen0 = x;
390
          else                     cen0 = centers[0];
391

    
392
               if( centers[1]==Y ) cen1 = y;
393
          else if( centers[1]==X ) cen1 = x;
394
          else                     cen1 = centers[1];
395

    
396
               if( centers[2]==Y ) cen2 = y;
397
          else if( centers[2]==X ) cen2 = x;
398
          else                     cen2 = centers[2];
399

    
400
          CENTERS[index] = new float[] {cen0,cen1,cen2};
401
          }
402
        }
403

    
404
      x = (3-numLayers)*0.5f;
405

    
406
      for(int i=0; i<numLayers-2; i++, x+=1.0f)
407
        {
408
        y = (3-numLayers)*0.5f;
409

    
410
        for(int j=0; j<numLayers-2; j++, y+=1.0f, index++)
411
          {
412
               if( centers[0]==Y ) cen0 = y;
413
          else if( centers[0]==X ) cen0 = x;
414
          else                     cen0 = centers[0];
415

    
416
               if( centers[1]==Y ) cen1 = y;
417
          else if( centers[1]==X ) cen1 = x;
418
          else                     cen1 = centers[1];
419

    
420
               if( centers[2]==Y ) cen2 = y;
421
          else if( centers[2]==X ) cen2 = x;
422
          else                     cen2 = centers[2];
423

    
424
          CENTERS[index] = new float[] {cen0,cen1,cen2};
425
          }
426
        }
427
      }
428

    
429
    return CENTERS;
430
    }
431

    
432
///////////////////////////////////////////////////////////////////////////////////////////////////
433

    
434
  Static4D getQuat(int cubit, int numLayers)
435
    {
436
    int numCorners = getNumCorners();
437
    int numEdges   = getNumEdges(numLayers);
438

    
439
    if( cubit<numCorners )
440
      {
441
      switch(cubit)
442
        {
443
        case  0: return QUATS[0];                          //  unit quat
444
        case  1: return new Static4D( SQ2/2,0,0,SQ2/2);    //  90 along X
445
        case  2: return new Static4D(-SQ2/2,0,0,SQ2/2);    // -90 along X
446
        case  3: return QUATS[1];                          // 180 along X
447
        case  4: return new Static4D(0, SQ2/2,0,SQ2/2);    //  90 along Y
448
        case  5: return QUATS[2];                          // 180 along Y
449
        case  6: return QUATS[3];                          // 180 along Z
450
        case  7: return new Static4D(SQ2/2,0,-SQ2/2,0);    // 180 along (SQ2/2,0,-SQ2/2)
451
        }
452
      }
453
    else if( cubit<numCorners+numEdges )
454
      {
455
      int edge = (cubit-numCorners)/(numLayers-2);
456

    
457
      switch(edge)
458
        {
459
        case  0: return QUATS[ 0];
460
        case  1: return QUATS[ 5];
461
        case  2: return QUATS[ 3];
462
        case  3: return QUATS[11];
463
        case  4: return QUATS[ 4];
464
        case  5: return QUATS[ 7];
465
        case  6: return QUATS[ 9];
466
        case  7: return QUATS[10];
467
        case  8: return QUATS[ 2];
468
        case  9: return QUATS[ 8];
469
        case 10: return QUATS[ 1];
470
        case 11: return QUATS[ 6];
471
        }
472
      }
473
    else
474
      {
475
      int center = (cubit-numCorners-numEdges)/getNumCentersPerFace(numLayers);
476

    
477
      switch(center)
478
        {
479
        case 0: return new Static4D(0,-SQ2/2,0,SQ2/2);    // -90 along Y
480
        case 1: return new Static4D(0, SQ2/2,0,SQ2/2);    //  90 along Y
481
        case 2: return new Static4D( SQ2/2,0,0,SQ2/2);    //  90 along X
482
        case 3: return new Static4D(-SQ2/2,0,0,SQ2/2);    // -90 along X
483
        case 4: return QUATS[0];                          //  unit quaternion
484
        case 5: return QUATS[1];                          // 180 along X
485
        }
486
      }
487

    
488
    return null;
489
    }
490

    
491
///////////////////////////////////////////////////////////////////////////////////////////////////
492

    
493
  ObjectShape getObjectShape(int cubit, int numLayers)
494
    {
495
    int variant = getCubitVariant(cubit,numLayers);
496

    
497
    if( variant==0 )
498
      {
499
      int N = numLayers==2 ? 7:5;
500
      int E1= numLayers==2 ? 3:2;
501
      int E2= numLayers==2 ? 5:3;
502
      float[][] bands     = new float[][] { {0.028f,35,0.16f,0.7f,N,E1,E1}, {0.000f, 0,1.00f,0.0f,3,1,E2} };
503
      int[] bandIndices   = new int[] { 0,0,0,1,1,1 };
504
      float[][] corners   = new float[][] { {0.08f,0.15f}, {0.08f,0.20f} };
505
      int[] cornerIndices = new int[] { 1,1,1,0,0 };
506
      float[][] centers   = new float[][] { {-0.25f, -0.25f, -0.25f} };
507
      int[] centerIndices = new int[] { 0,0,0,-1,0 };
508
      return new ObjectShape(VERTICES_CORNER,VERT_INDEXES_CORNER,bands,bandIndices,corners,cornerIndices,centers,centerIndices,getNumCubitFaces(), null);
509
      }
510
    else if( variant==1 )
511
      {
512
      int N = numLayers==2 ? 7:5;
513
      int E = numLayers==2 ? 5:2;
514
      float[][] bands     = new float[][] { {0.035f,30,0.16f,0.8f,N,2,E}, {0.020f,45,0.16f,0.2f,3,1,2} };
515
      int[] bandIndices   = new int[] { 0,0,1,1 };
516
      float[][] corners   = new float[][] { {0.07f,0.20f}, {0.02f,0.30f} };
517
      int[] cornerIndices = new int[] { 0,0,1,1 };
518
      float[][] centers   = new float[][] { {0.0f, -0.25f, -0.25f} };
519
      int[] centerIndices = new int[] { 0,0,0,0 };
520
      return new ObjectShape(VERTICES_EDGE,VERT_INDEXES_EDGE,bands,bandIndices,corners,cornerIndices,centers,centerIndices,getNumCubitFaces(), null);
521
      }
522
    else
523
      {
524
      int N = numLayers==2 ? 7:6;
525
      int E = numLayers==2 ? 3:1;
526
      float[][] bands     = new float[][] { {0.051f,35,SQ2/8,0.9f,N,E,E}, {0.000f,0,1,0.0f,3,0,0} };
527
      int[] bandIndices   = new int[] { 0,1,1,1,1 };
528
      float[][] corners   = new float[][] { {0.06f,0.10f} };
529
      int[] cornerIndices = new int[] { 0,0,0,0,0 };
530
      float[][] centers   = new float[][] { {0,0,-0.2f} };
531
      int[] centerIndices = new int[] { 0,0,0,0,-1 };
532
      return new ObjectShape(VERTICES_FACE,VERT_INDEXES_FACE,bands,bandIndices,corners,cornerIndices,centers,centerIndices,getNumCubitFaces(), null);
533
      }
534
    }
535

    
536
///////////////////////////////////////////////////////////////////////////////////////////////////
537

    
538
  int getNumCubitVariants(int numLayers)
539
    {
540
    return 3;
541
    }
542

    
543
///////////////////////////////////////////////////////////////////////////////////////////////////
544

    
545
  int getCubitVariant(int cubit, int numLayers)
546
    {
547
    int numCorners = getNumCorners();
548
    if( cubit<numCorners ) return 0;
549
    int numEdges = getNumEdges(numLayers);
550
    return cubit<numCorners+numEdges ? 1:2;
551
    }
552

    
553
///////////////////////////////////////////////////////////////////////////////////////////////////
554

    
555
  int getFaceColor(int cubit, int cubitface, int numLayers)
556
    {
557
    int numCorners = getNumCorners();
558
    int numEdges   = getNumEdges(numLayers);
559

    
560
    if( cubit<numCorners )
561
      {
562
      return mCornerMap[cubit][cubitface];
563
      }
564
    else if( cubit<numCorners+numEdges )
565
      {
566
      int edge = (cubit-numCorners)/(numLayers-2);
567
      return mEdgeMap[edge][cubitface];
568
      }
569
    else
570
      {
571
      int center = (cubit-numCorners-numEdges)/getNumCentersPerFace(numLayers);
572
      return mCenterMap[center][cubitface];
573
      }
574
    }
575

    
576
///////////////////////////////////////////////////////////////////////////////////////////////////
577

    
578
  int getColor(int face)
579
    {
580
    return FACE_COLORS[face];
581
    }
582

    
583
///////////////////////////////////////////////////////////////////////////////////////////////////
584

    
585
  ObjectSticker retSticker(int face)
586
    {
587
    return mStickers[face/NUM_FACES];
588
    }
589

    
590
///////////////////////////////////////////////////////////////////////////////////////////////////
591

    
592
  float returnMultiplier()
593
    {
594
    return 2.0f;
595
    }
596

    
597
///////////////////////////////////////////////////////////////////////////////////////////////////
598
// PUBLIC API
599

    
600
  public Static3D[] getRotationAxis()
601
    {
602
    return ROT_AXIS;
603
    }
604

    
605
///////////////////////////////////////////////////////////////////////////////////////////////////
606

    
607
  public int[] getBasicAngle()
608
    {
609
    return BASIC_ANGLE;
610
    }
611

    
612
///////////////////////////////////////////////////////////////////////////////////////////////////
613

    
614
  public void randomizeNewScramble(int[][] scramble, Random rnd, int curr, int totalScrambles)
615
    {
616
    if( curr==0 )
617
      {
618
      mCurrState     = 0;
619
      mIndexExcluded =-1;
620
      }
621

    
622
    int total = mStates[mCurrState].getTotal(mIndexExcluded);
623
    int random= rnd.nextInt(total);
624
    int[] info= mStates[mCurrState].getInfo(random,mIndexExcluded);
625

    
626
    scramble[curr][0] = info[0];
627
    scramble[curr][1] = info[1];
628
    scramble[curr][2] = info[2];
629

    
630
    mCurrState     = info[3];
631
    mIndexExcluded = info[0];
632
    }
633

    
634
///////////////////////////////////////////////////////////////////////////////////////////////////
635

    
636
  public int getObjectName(int numLayers)
637
    {
638
    switch(numLayers)
639
      {
640
      case 2: return R.string.skew2;
641
      case 3: return R.string.skew3;
642
      }
643
    return R.string.skew2;
644
    }
645

    
646
///////////////////////////////////////////////////////////////////////////////////////////////////
647

    
648
  public int getInventor(int numLayers)
649
    {
650
    switch(numLayers)
651
      {
652
      case 2: return R.string.skew2_inventor;
653
      case 3: return R.string.skew3_inventor;
654
      }
655
    return R.string.skew2_inventor;
656
    }
657

    
658
///////////////////////////////////////////////////////////////////////////////////////////////////
659

    
660
  public int getComplexity(int numLayers)
661
    {
662
    switch(numLayers)
663
      {
664
      case 2: return 4;
665
      case 3: return 8;
666
      }
667
    return 5;
668
    }
669
}
(37-37/41)