Project

General

Profile

« Previous | Next » 

Revision bedc2ebf

Added by Leszek Koltunski 8 months ago

theoretically Ghosts are now implemented so that init state of individual layers along the ghostAxis can be rotated arbitrary number of times along the ghostAngle (as are all real ghostCube of size >= 3x3 ) and if the cube is not ghost-blocked, we can always rotate the layers by one or two ghostAngles.

View differences:

src/main/java/org/distorted/objectlib/scrambling/ScrambleEdgeGenerator.java
212 212
  public static int[][] getScrambleEdgesGhost(int[][] basicAngles, int ghostAxis, int[] rowState)
213 213
    {
214 214
    int[] counters = (rowState!=null ? new int[rowState.length] : null);
215
    int nonZero = getNumInitGhostMoves(rowState,counters);
216
    int sizeGhost = basicAngles[ghostAxis][0];
215
    int nonZeroMoves = getNumInitGhostMoves(rowState,counters);
216
    int basicNum = 360/basicAngles[ghostAxis][0];
217
    int numInitMoves = basicNum*nonZeroMoves;
217 218

  
218
    // TODO
219
    int[] edge0 = new int[2*sizeGhost];
219
    int[][] edges = new int[nonZeroMoves+1][];
220 220

  
221
    for( int m=0; m<sizeGhost; m++ )
221
    for( int m=0; m<nonZeroMoves; m++ )
222 222
      {
223
      edge0[2*m  ] = m;
224
      edge0[2*m+1] = 1;
223
      edges[m] = new int[2*basicNum];
224

  
225
      for(int i=0; i<basicNum; i++)
226
        {
227
        edges[m][2*i  ] = m*basicNum + i;
228
        edges[m][2*i+1] = m+1;
229
        }
225 230
      }
226 231

  
227 232
    int sizeNonGhost = 0;
228 233
    for (int[] basic : basicAngles)
229 234
      for (int i : basic) sizeNonGhost += (i-1);
230 235

  
231
    int[] edge1 = new int[2*sizeNonGhost];
236
    edges[nonZeroMoves] = new int[2*sizeNonGhost];
232 237

  
233 238
    for( int m=0; m<sizeNonGhost; m++ )
234 239
      {
235
      edge1[2*m  ] = m+sizeGhost;
236
      edge1[2*m+1] = 1;
240
      edges[nonZeroMoves][2*m  ] = m+numInitMoves;
241
      edges[nonZeroMoves][2*m+1] = nonZeroMoves;
237 242
      }
238 243

  
239
    return new int[][] { edge0,edge1 };
244
    return edges;
240 245
    }
241 246

  
242 247
///////////////////////////////////////////////////////////////////////////////////////////////////

Also available in: Unified diff