commit 73515bf871951ab60a40319253e3d51cd01108f2
Author: leszek <leszek@koltunski.pl>
Date:   Thu Oct 5 00:22:33 2023 +0200

    improve scrambling of the Tins and Lattice Cubes.

diff --git a/src/main/java/org/distorted/objectlib/objects/TwistyLattice.java b/src/main/java/org/distorted/objectlib/objects/TwistyLattice.java
index c788e693..8f54595b 100644
--- a/src/main/java/org/distorted/objectlib/objects/TwistyLattice.java
+++ b/src/main/java/org/distorted/objectlib/objects/TwistyLattice.java
@@ -44,6 +44,7 @@ public class TwistyLattice extends ShapeHexahedron
   private float[][] mCuts;
   private float[][] mPositions;
   private int[] mQuatIndex;
+  private boolean[][] mRotatable;
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
@@ -67,10 +68,44 @@ public class TwistyLattice extends ShapeHexahedron
 
   public int[][] getScrambleEdges()
     {
-    if( mEdges==null ) mEdges = ScrambleEdgeGenerator.getScrambleEdgesSingle(mBasicAngle);
+    if( mEdges==null )
+      {
+      mEdges = new int[][]
+        {
+         { 0,16,1,16,2,8,3,8,  4,1,5,1,6,9,7,9,  8,15,9,15,10,7,11,7,  12,2,13,2,14,10,15,10,  16,14,17,14,18,6,19,6,  20,3,21,3,22,11,23,11,  24,13,25,13,26,5,27,5,  28,4,29,4,30,12,31,12 },  // 0
+
+         {                                                             12,2,13,2,14,10,15,10,                          20,3,21,3,22,11,23,11,  24,13,25,13,26,5,27,5,                        },  // 1
+         {                     4,1,5,1,6,9,7,9,                                                16,14,17,14,18,6,19,6,                                                  28,4,29,4,30,12,31,12 },  // 2
+         {                     4,1,5,1,6,9,7,9,  8,15,9,15,10,7,11,7,                                                                                                  28,4,29,4,30,12,31,12 },  // 3
+         { 0,16,1,16,2,8,3,8,                                          12,2,13,2,14,10,15,10,                          20,3,21,3,22,11,23,11,                                                },  // 4
+         {                     4,1,5,1,6,9,7,9,  8,15,9,15,10,7,11,7,                          16,14,17,14,18,6,19,6,                                                                        },  // 5
+         { 0,16,1,16,2,8,3,8,                                          12,2,13,2,14,10,15,10,                                                  24,13,25,13,26,5,27,5,                        },  // 6
+         { 0,16,1,16,2,8,3,8,                                                                                          20,3,21,3,22,11,23,11,  24,13,25,13,26,5,27,5,                        },  // 7
+         {                                       8,15,9,15,10,7,11,7,                          16,14,17,14,18,6,19,6,                                                  28,4,29,4,30,12,31,12 },  // 8
+
+         {                                                             12,2,13,2,                                      20,3,21,3,                          26,5,27,5,                        },  // 9
+         {                     4,1,5,1,                                                                    18,6,19,6,                                                  28,4,29,4,            },  // 10
+         {                     4,1,5,1,                    10,7,11,7,                                                                                                  28,4,29,4,            },  // 11
+         {           2,8,3,8,                                          12,2,13,2,                                      20,3,21,3,                                                            },  // 12
+         {                     4,1,5,1,                    10,7,11,7,                                      18,6,19,6,                                                                        },  // 13
+         {           2,8,3,8,                                          12,2,13,2,                                                                          26,5,27,5,                        },  // 14
+         {           2,8,3,8,                                                                                          20,3,21,3,                          26,5,27,5,                        },  // 15
+         {                                                 10,7,11,7,                                      18,6,19,6,                                                  28,4,29,4,            },  // 16
+        };
+      }
+
     return mEdges;
     }
 
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+  @Override
+  public int[][] getScrambleAlgorithms()
+    {
+    if( mRotatable==null ) createRotatable();
+    return ScrambleEdgeGenerator.getScramblingAlgorithms(mBasicAngle, mRotatable);
+    }
+
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
   public float[][] getCuts(int[] numLayers)
@@ -87,10 +122,18 @@ public class TwistyLattice extends ShapeHexahedron
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
-  public boolean[][] getLayerRotatable(int[] numLayers)
+  private void createRotatable()
     {
     boolean[] tmp = new boolean[] {true,true,false,true,true};
-    return new boolean[][] { tmp,tmp,tmp,tmp };
+    mRotatable = new boolean[][] { tmp,tmp,tmp,tmp };
+    }
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+  public boolean[][] getLayerRotatable(int[] numLayers)
+    {
+    if( mRotatable==null ) createRotatable();
+    return mRotatable;
     }
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
@@ -218,7 +261,7 @@ public class TwistyLattice extends ShapeHexahedron
     {
     if( variant==0 )
       {
-      int N = 6;
+      int N = 4;
       int E = 1;
       float height = isInIconMode() ? 0.001f : 0.04f;
       float[][] bands = { {height,35,SQ2/8,0.9f,N,E,E}, {0.001f,35,1,0.0f,3,0,0} };
@@ -243,11 +286,12 @@ public class TwistyLattice extends ShapeHexahedron
     {
     if( variant==0 )
       {
-      float[][] corners   = { {0.06f,0.15f} };
+      final float C = 1.25f;
+      float[][] corners   = { {0.03f,0.15f} };
       int[] cornerIndices = { 0,0,0,0,0 };
-      float[][] centers   = { {0,0,-0.4f} };
-      int[] centerIndices = { 0,0,0,0,-1 };
-       return FactoryCubit.generateVertexEffect(getVertices(variant),corners,cornerIndices,centers,centerIndices);
+      float[][] centers   = { {-C,0,-C},{0,-C,-C},{C,0,-C},{0,C,-C} };
+      int[] centerIndices = { 0,1,2,3,-1 };
+      return FactoryCubit.generateVertexEffect(getVertices(variant),corners,cornerIndices,centers,centerIndices);
       }
     else
       {
@@ -354,7 +398,7 @@ public class TwistyLattice extends ShapeHexahedron
 
   public int getComplexity()
     {
-    return 1;
+    return 2;
     }
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
diff --git a/src/main/java/org/distorted/objectlib/objects/TwistyTins.java b/src/main/java/org/distorted/objectlib/objects/TwistyTins.java
index 4ce171c1..4b7b1684 100644
--- a/src/main/java/org/distorted/objectlib/objects/TwistyTins.java
+++ b/src/main/java/org/distorted/objectlib/objects/TwistyTins.java
@@ -59,8 +59,28 @@ public class TwistyTins extends ShapeHexahedron
     {
     if( mEdges==null )
       {
-      setUpRotatable();
-      mEdges = ScrambleEdgeGenerator.getScrambleEdgesSingle(mBasicAngle, mRotatable);
+      mEdges = new int[][]
+        {
+          { 0,16,1,16,2,8,3,8,  4,1,5,1,6,9,7,9,  8,15,9,15,10,7,11,7,  12,2,13,2,14,10,15,10,  16,14,17,14,18,6,19,6,  20,3,21,3,22,11,23,11,  24,13,25,13,26,5,27,5,  28,4,29,4,30,12,31,12 },  // 0
+
+          {                                                             12,2,13,2,14,10,15,10,                          20,3,21,3,22,11,23,11,  24,13,25,13,26,5,27,5,                        },  // 1
+          {                     4,1,5,1,6,9,7,9,                                                16,14,17,14,18,6,19,6,                                                  28,4,29,4,30,12,31,12 },  // 2
+          {                     4,1,5,1,6,9,7,9,  8,15,9,15,10,7,11,7,                                                                                                  28,4,29,4,30,12,31,12 },  // 3
+          { 0,16,1,16,2,8,3,8,                                          12,2,13,2,14,10,15,10,                          20,3,21,3,22,11,23,11,                                                },  // 4
+          {                     4,1,5,1,6,9,7,9,  8,15,9,15,10,7,11,7,                          16,14,17,14,18,6,19,6,                                                                        },  // 5
+          { 0,16,1,16,2,8,3,8,                                          12,2,13,2,14,10,15,10,                                                  24,13,25,13,26,5,27,5,                        },  // 6
+          { 0,16,1,16,2,8,3,8,                                                                                          20,3,21,3,22,11,23,11,  24,13,25,13,26,5,27,5,                        },  // 7
+          {                                       8,15,9,15,10,7,11,7,                          16,14,17,14,18,6,19,6,                                                  28,4,29,4,30,12,31,12 },  // 8
+
+          {                                                             12,2,13,2,                                      20,3,21,3,                          26,5,27,5,                        },  // 9
+          {                     4,1,5,1,                                                                    18,6,19,6,                                                  28,4,29,4,            },  // 10
+          {                     4,1,5,1,                    10,7,11,7,                                                                                                  28,4,29,4,            },  // 11
+          {           2,8,3,8,                                          12,2,13,2,                                      20,3,21,3,                                                            },  // 12
+          {                     4,1,5,1,                    10,7,11,7,                                      18,6,19,6,                                                                        },  // 13
+          {           2,8,3,8,                                          12,2,13,2,                                                                          26,5,27,5,                        },  // 14
+          {           2,8,3,8,                                                                                          20,3,21,3,                          26,5,27,5,                        },  // 15
+          {                                                 10,7,11,7,                                      18,6,19,6,                                                  28,4,29,4,            },  // 16
+        };
       }
 
     return mEdges;
diff --git a/src/main/java/org/distorted/objectlib/tablebases/TablebasesAbstract.java b/src/main/java/org/distorted/objectlib/tablebases/TablebasesAbstract.java
index f807a4cc..bc80e3fa 100644
--- a/src/main/java/org/distorted/objectlib/tablebases/TablebasesAbstract.java
+++ b/src/main/java/org/distorted/objectlib/tablebases/TablebasesAbstract.java
@@ -646,7 +646,7 @@ public abstract class TablebasesAbstract
 
     int[] extra = new int[4];
 
-    for(int i=8375000; i<19958400; i++)
+    for(int i=9067000; i<19958400; i++)
       {
       int[][] sol = solution(i,extra,os);
       if( (i%1000)==0 ) android.util.Log.e("D ", "solving: "+i);
