commit 15d1f6ad89f5ba495f01fae3005033a42013430e
Author: Leszek Koltunski <leszek@koltunski.pl>
Date:   Wed Mar 15 16:43:01 2023 +0100

    creation of PruningTables.

diff --git a/src/main/java/org/distorted/objectlib/tablebases/PruningTable.java b/src/main/java/org/distorted/objectlib/tablebases/PruningTable.java
index c7dae1b3..71d2a3c4 100644
--- a/src/main/java/org/distorted/objectlib/tablebases/PruningTable.java
+++ b/src/main/java/org/distorted/objectlib/tablebases/PruningTable.java
@@ -256,6 +256,8 @@ class PruningTable
     int size = retNumPositions(table,level);
     int tableSize = table.getSize();
 
+    android.util.Log.e("D", "----- PRUNING TABLE LEVEL "+level+" ------");
+
     for(int i=0; i<supported.length; i++)
       {
       int approx = computeApproximateSize( tableSize, size, supported[i]);
diff --git a/src/main/java/org/distorted/objectlib/tablebases/TablebasesAbstract.java b/src/main/java/org/distorted/objectlib/tablebases/TablebasesAbstract.java
index 95bb8ae2..8a646654 100644
--- a/src/main/java/org/distorted/objectlib/tablebases/TablebasesAbstract.java
+++ b/src/main/java/org/distorted/objectlib/tablebases/TablebasesAbstract.java
@@ -41,10 +41,11 @@ public abstract class TablebasesAbstract
   private final boolean[][] mRotatable;
   private final int mScalingFactor;
 
-  private Tablebase mTablebase;
   private int[][] mQuatMult;
   private boolean mInitialized;
 
+  Tablebase mTablebase;
+
   private static final float[] mTmp = new float[4];
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
@@ -60,7 +61,6 @@ public abstract class TablebasesAbstract
   abstract int getSize();
   abstract int[] getQuats(int index);
   abstract int getIndex(int[] quats);
-  abstract int[] getPruningLevels();
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
@@ -315,9 +315,12 @@ public abstract class TablebasesAbstract
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
-  public byte[] getPacked()
+  public byte[][] getPacked()
     {
-    return mTablebase.getPacked();
+    if( !mInitialized ) createTablebase(-1);
+    byte[] data = mTablebase.getPacked();
+
+    return new byte[][] { data };
     }
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
diff --git a/src/main/java/org/distorted/objectlib/tablebases/TablebasesCuboid232.java b/src/main/java/org/distorted/objectlib/tablebases/TablebasesCuboid232.java
index 28c83997..1b2f2857 100644
--- a/src/main/java/org/distorted/objectlib/tablebases/TablebasesCuboid232.java
+++ b/src/main/java/org/distorted/objectlib/tablebases/TablebasesCuboid232.java
@@ -117,13 +117,6 @@ public class TablebasesCuboid232 extends TablebasesAbstract
     return 12;
     }
 
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
-  int[] getPruningLevels()
-    {
-    return null;
-    }
-
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
   private void getCornerQuats(int[] output, int[] perm)
diff --git a/src/main/java/org/distorted/objectlib/tablebases/TablebasesIvyCube.java b/src/main/java/org/distorted/objectlib/tablebases/TablebasesIvyCube.java
index d6cb6a75..71b562b3 100644
--- a/src/main/java/org/distorted/objectlib/tablebases/TablebasesIvyCube.java
+++ b/src/main/java/org/distorted/objectlib/tablebases/TablebasesIvyCube.java
@@ -119,13 +119,6 @@ public class TablebasesIvyCube extends TablebasesAbstract
     return 7;
     }
 
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
-  int[] getPruningLevels()
-    {
-    return null;
-    }
-
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
   private int findFirst(int[] table, int value)
diff --git a/src/main/java/org/distorted/objectlib/tablebases/TablebasesMITM.java b/src/main/java/org/distorted/objectlib/tablebases/TablebasesMITM.java
index 136e0995..5992639e 100644
--- a/src/main/java/org/distorted/objectlib/tablebases/TablebasesMITM.java
+++ b/src/main/java/org/distorted/objectlib/tablebases/TablebasesMITM.java
@@ -23,6 +23,10 @@ public abstract class TablebasesMITM extends TablebasesAbstract
   private boolean mInitialized;
   private int[] mLevels;
 
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+  abstract int[] getPruningLevels();
+
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
   private void createPruningTable(Resources res, int id, int index)
@@ -72,6 +76,30 @@ public abstract class TablebasesMITM extends TablebasesAbstract
     for(int i=0; i<numOfIDs; i++) createPruningTable(res,resourceIDs[i],i);
     }
 
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+  public byte[][] getPacked()
+    {
+    int[] levels = getPruningLevels();
+    int numLevels = levels.length;
+    int maxLevel = 0;
+
+    for( int l : levels )
+      if( l>maxLevel ) maxLevel = l;
+
+    createTablebase(maxLevel);
+
+    byte[][] data = new byte[numLevels][];
+
+    for(int i=0; i<numLevels; i++)
+      {
+      PruningTable table = new PruningTable(mTablebase,levels[i]);
+      data[i] = table.getPacked();
+      }
+
+    return data;
+    }
+
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
   public int[][] solution(int index, int[] extra)
diff --git a/src/main/java/org/distorted/objectlib/tablebases/TablebasesPyraminx.java b/src/main/java/org/distorted/objectlib/tablebases/TablebasesPyraminx.java
index 0c51177e..3bd0f392 100644
--- a/src/main/java/org/distorted/objectlib/tablebases/TablebasesPyraminx.java
+++ b/src/main/java/org/distorted/objectlib/tablebases/TablebasesPyraminx.java
@@ -246,13 +246,6 @@ public class TablebasesPyraminx extends TablebasesAbstract
     return 9;
     }
 
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
-  int[] getPruningLevels()
-    {
-    return null;
-    }
-
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
   public static void getEdgePermutation(int[] output, int[] quats, int index)
diff --git a/src/main/java/org/distorted/objectlib/tablebases/TablebasesPyraminxDuo.java b/src/main/java/org/distorted/objectlib/tablebases/TablebasesPyraminxDuo.java
index b3472ca5..494e3f3e 100644
--- a/src/main/java/org/distorted/objectlib/tablebases/TablebasesPyraminxDuo.java
+++ b/src/main/java/org/distorted/objectlib/tablebases/TablebasesPyraminxDuo.java
@@ -106,13 +106,6 @@ public class TablebasesPyraminxDuo extends TablebasesAbstract
     return 4;
     }
 
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
-  int[] getPruningLevels()
-    {
-    return null;
-    }
-
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
   int[] getQuats(int index)
diff --git a/src/main/java/org/distorted/objectlib/tablebases/TablebasesSkewbDiamond.java b/src/main/java/org/distorted/objectlib/tablebases/TablebasesSkewbDiamond.java
index 7657dbf3..67d50312 100644
--- a/src/main/java/org/distorted/objectlib/tablebases/TablebasesSkewbDiamond.java
+++ b/src/main/java/org/distorted/objectlib/tablebases/TablebasesSkewbDiamond.java
@@ -131,13 +131,6 @@ public class TablebasesSkewbDiamond extends TablebasesAbstract
     return 8;
     }
 
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
-  int[] getPruningLevels()
-    {
-    return null;
-    }
-
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
   private int computeCenterQuat(int originalLocation, int newLocation)
