Project

General

Profile

« Previous | Next » 

Revision acf2a9e1

Added by Leszek Koltunski 12 months ago

Support for automatic creation of Scramble Algorithms and Edges which ignore the 'non-rotatable' layers.
Implement this to the Coin Tetrahedron, Ancient Coin Cube & Tins Cube.

View differences:

src/main/java/org/distorted/objectlib/scrambling/ScrambleEdgeGenerator.java
92 92
    return new int[][] { edge };
93 93
    }
94 94

  
95
///////////////////////////////////////////////////////////////////////////////////////////////////
96

  
97
  public static int[][] getScrambleEdgesSingle(int[][] basicAngles, boolean[][] rotatable)
98
    {
99
    int num=0;
100
    int numAxis= basicAngles.length;
101

  
102
    for(int a=0; a<numAxis; a++)
103
      {
104
      int[] angles = basicAngles[a];
105
      int numLayers = angles.length;
106

  
107
      for(int l=0; l<numLayers; l++)
108
        if( rotatable[a][l] )
109
          num += (angles[l]-1);
110
      }
111

  
112
    int[] edge = new int[2*num];
113
    for(int i=0; i<num; i++)
114
      {
115
      edge[2*i  ] = i;
116
      edge[2*i+1] = 0;
117
      }
118

  
119
    return new int[][] { edge };
120
    }
121

  
95 122
///////////////////////////////////////////////////////////////////////////////////////////////////
96 123

  
97 124
  public static int[][] getScramblingAlgorithms(int[][] basicAngles)
......
135 162

  
136 163
    return ret;
137 164
    }
165

  
166
///////////////////////////////////////////////////////////////////////////////////////////////////
167

  
168
  public static int[][] getScramblingAlgorithms(int[][] basicAngles, boolean[][] rotatable)
169
    {
170
    int numAxis= basicAngles.length;
171
    int num=0;
172

  
173
    for(int a=0; a<numAxis; a++)
174
      {
175
      int[] angles = basicAngles[a];
176
      int numLayers = angles.length;
177

  
178
      for(int l=0; l<numLayers; l++)
179
        if( rotatable[a][l] )
180
          num += (angles[l]-1);
181
      }
182

  
183
    int[][] ret = new int[num][3];
184
    int index = 0;
185

  
186
    for(int a=0; a<numAxis; a++)
187
      {
188
      int numLayers = basicAngles[a].length;
189

  
190
      for(int l=0; l<numLayers; l++)
191
        {
192
        if( rotatable[a][l] )
193
          {
194
          int N = basicAngles[a][l];
195
          int NEG = (1-N)/2;
196
          int POS = N/2;
197

  
198
          for(int k=NEG; k<=-1; k++)
199
            {
200
            ret[index][0] = a;
201
            ret[index][1] = l;
202
            ret[index][2] = k;
203
            index++;
204
            }
205

  
206
          for(int k=1; k<=POS; k++)
207
            {
208
            ret[index][0] = a;
209
            ret[index][1] = l;
210
            ret[index][2] = k;
211
            index++;
212
            }
213
          }
214
        }
215
      }
216

  
217
    return ret;
218
    }
138 219
  }
139 220

  

Also available in: Unified diff