Project

General

Profile

« Previous | Next » 

Revision 20898e6f

Added by Leszek Koltunski over 2 years ago

Convert both Dinos to the new, unified scrambling method.

View differences:

src/main/java/org/distorted/objects/TwistyDino6.java
21 21

  
22 22
import android.content.res.Resources;
23 23

  
24
import org.distorted.helpers.ScrambleStateGraph;
24 25
import org.distorted.library.main.DistortedEffects;
25 26
import org.distorted.library.main.DistortedTexture;
26 27
import org.distorted.library.mesh.MeshSquare;
27 28
import org.distorted.library.type.Static4D;
28 29
import org.distorted.main.R;
29 30

  
30
import java.util.Random;
31

  
32 31
///////////////////////////////////////////////////////////////////////////////////////////////////
33 32

  
34 33
public class TwistyDino6 extends TwistyDino
......
43 42
              DistortedEffects effects, int[][] moves, Resources res, int scrWidth)
44 43
    {
45 44
    super(size, quat, texture, mesh, effects, moves, ObjectList.DINO, res, scrWidth);
45

  
46
    mStates = new ScrambleStateGraph[]
47
      {
48
      new ScrambleStateGraph( new int[][] { {0,1,1,0,-1,1, 2,1,2,2,-1,2},{0,1,3,0,-1,3, 2,1,4,2,-1,4},{0,1,5,0,-1,5, 2,1,6,2,-1,6},{0,1,7,0,-1,7, 2,1,8,2,-1,8} } ),
49
      new ScrambleStateGraph( new int[][] { {                          },{0,1,3,0,-1,3              },{0,1,5,0,-1,5,             },{              2,1,8,2,-1,8} } ),
50
      new ScrambleStateGraph( new int[][] { {                          },{              2,1,4,2,-1,4},{              2,1,6,2,-1,6},{0,1,7,0,-1,7              } } ),
51
      new ScrambleStateGraph( new int[][] { {0,1,1,0,-1,1              },{                          },{              2,1,6,2,-1,6},{0,1,7,0,-1,7              } } ),
52
      new ScrambleStateGraph( new int[][] { {              2,1,2,2,-1,2},{                          },{0,1,5,0,-1,5,             },{              2,1,8,2,-1,8} } ),
53
      new ScrambleStateGraph( new int[][] { {0,1,1,0,-1,1              },{              2,1,4,2,-1,4},{                          },{0,1,7,0,-1,7              } } ),
54
      new ScrambleStateGraph( new int[][] { {              2,1,2,2,-1,2},{0,1,3,0,-1,3              },{                          },{              2,1,8,2,-1,8} } ),
55
      new ScrambleStateGraph( new int[][] { {              2,1,2,2,-1,2},{0,1,3,0,-1,3              },{0,1,5,0,-1,5,             },{                          } } ),
56
      new ScrambleStateGraph( new int[][] { {0,1,1,0,-1,1              },{              2,1,4,2,-1,4},{              2,1,6,2,-1,6},{                          } } ),
57
      };
46 58
    }
47 59

  
48 60
///////////////////////////////////////////////////////////////////////////////////////////////////
......
101 113
    return false;
102 114
    }
103 115

  
104
///////////////////////////////////////////////////////////////////////////////////////////////////
105

  
106
  public void randomizeNewScramble(int[][] scramble, Random rnd, int curr, int total)
107
    {
108
    if( curr==0 )
109
      {
110
      scramble[curr][0] = rnd.nextInt(NUM_AXIS);
111
      scramble[curr][1] = rnd.nextFloat()<=0.5f ? 0:2;
112
      }
113
    else
114
      {
115
      int newVector = rnd.nextInt(NUM_AXIS-1);
116
      scramble[curr][0] = (newVector>=scramble[curr-1][0] ? newVector+1 : newVector);
117
      scramble[curr][1] = scramble[curr-1][0]+scramble[curr][0]==3 ? 2-scramble[curr-1][1] : scramble[curr-1][1];
118
      }
119

  
120
    switch( rnd.nextInt(2) )
121
      {
122
      case 0: scramble[curr][2] = -1; break;
123
      case 1: scramble[curr][2] =  1; break;
124
      }
125
    }
126

  
127 116
///////////////////////////////////////////////////////////////////////////////////////////////////
128 117

  
129 118
  public int getObjectName(int numLayers)

Also available in: Unified diff