Project

General

Profile

« Previous | Next » 

Revision 9ba7f3f6

Added by Leszek Koltunski over 1 year ago

Move scrambling to a new model where there are spearete scrambling 'algorithms' and 'edges' of the scrambling graph.
Now each edge can contain a whole algorithm, i.e. a sequence of moves leading from state to state, which permits construction of scrambling for more complicated bandaged objects such as the AI cube.

Unchecked as of yet, probably still a lot of bugs.

View differences:

src/main/java/org/distorted/objectlib/main/TwistyObject.java
239 239
    mBelongs = new boolean[mNumCubits];
240 240

  
241 241
    int scramblingType = getScrambleType();
242
    ScrambleState[] states = getScrambleStates();
243
    mScrambler = new ObjectScrambler(scramblingType, mNumAxis,mNumLayers,states);
242
    int[][] edges = getScrambleEdges();
243
    int[][] algorithms = getScrambleAlgorithms();
244

  
245
print_table("EDGES", edges);
246
print_table("ALGOS", algorithms);
247

  
248
    mScrambler = new ObjectScrambler(scramblingType,mNumAxis,mNumLayers,algorithms,edges);
244 249

  
245 250
    boolean bandaged=false;
246 251

  
......
287 292
    mNode = new DistortedNode(mTexture,mEffects,mMesh);
288 293
    }
289 294

  
295
///////////////////////////////////////////////////////////////////////////////////////////////////
296

  
297
  private static void print_table(String mess, int[][] table)
298
    {
299
    android.util.Log.e("D", mess);
300

  
301
    int len = table.length;
302

  
303
    for(int i=0; i<len; i++)
304
      {
305
      String m = "";
306
      int l = table[i].length;
307
      for(int j=0; j<l; j++) m += (" "+table[i][j]);
308
      android.util.Log.e("D", m);
309
      }
310
    }
311

  
290 312
///////////////////////////////////////////////////////////////////////////////////////////////////
291 313

  
292 314
  private void createQuaternionEffects()
......
561 583
    return false;
562 584
    }
563 585

  
586
///////////////////////////////////////////////////////////////////////////////////////////////////
587

  
588
  public int[][] getScrambleAlgorithms()
589
    {
590
    int num=0;
591

  
592
    for (int[] basic : mBasicAngles)
593
      for (int i : basic) num += (i-1);
594

  
595
    int[][] ret = new int[num][3];
596
    int index = 0;
597

  
598
    for(int i=0; i<mNumAxis; i++)
599
      for(int j=0; j<mNumLayers[i]; j++)
600
        {
601
        int N = mBasicAngles[i][j];
602
        int NEG = (1-N)/2;
603
        int POS = N/2;
604

  
605
        for(int k=NEG; k<=-1; k++)
606
          {
607
          ret[index][0] = i;
608
          ret[index][1] = j;
609
          ret[index][2] = k;
610
          index++;
611
          }
612

  
613
        for(int k=1; k<=POS; k++)
614
          {
615
          ret[index][0] = i;
616
          ret[index][1] = j;
617
          ret[index][2] = k;
618
          index++;
619
          }
620
        }
621

  
622
    return ret;
623
    }
624

  
564 625
///////////////////////////////////////////////////////////////////////////////////////////////////
565 626

  
566 627
  private void createDataStructuresForSolved()
......
2184 2245
  public abstract int[][][] getEnabled();
2185 2246
  public abstract float[] getDist3D(int[] numLayers);
2186 2247
  public abstract Static3D[] getFaceAxis();
2187
  public abstract ScrambleState[] getScrambleStates();
2248
  public abstract int[][] getScrambleEdges();
2188 2249
  public abstract float[][] getCuts(int[] numLayers);
2189 2250
  public abstract float getStickerRadius();
2190 2251
  public abstract float getStickerStroke();

Also available in: Unified diff