commit 8ed251d68f698c13ee4c20f93c54c407347a8a54
Author: Leszek Koltunski <leszek@koltunski.pl>
Date:   Mon Apr 3 13:41:54 2023 +0200

    Progress with the Pyraminx Diamond solver.

diff --git a/src/main/java/org/distorted/objectlib/tablebases/TBPyraminxDiamond.java b/src/main/java/org/distorted/objectlib/tablebases/TBPyraminxDiamond.java
index 17e8cfac..10841fbc 100644
--- a/src/main/java/org/distorted/objectlib/tablebases/TBPyraminxDiamond.java
+++ b/src/main/java/org/distorted/objectlib/tablebases/TBPyraminxDiamond.java
@@ -21,24 +21,24 @@ public class TBPyraminxDiamond extends TablebasesAbstract
 {
   private static final int[][] CORNER_QUATS =
       {
-          {0,0,0,0},
-          {0,0,0,0},
-          {0,0,0,0},
-          {0,0,0,0},
-          {0,0,0,0},
-          {0,0,0,0},
+          {0,6,5,4},
+          {0,4,5,6},
+          {0,3,2,1},
+          {0,9,8,7},
+          {0,7,8,9},
+          {0,1,2,3},
       };
 
-  private static final int[][] CENTER_QUATS =
+  private static final int[][][] CENTER_QUATS =
       {
-          {0,0,0,0,0,0,0,0},
-          {0,0,0,0,0,0,0,0},
-          {0,0,0,0,0,0,0,0},
-          {0,0,0,0,0,0,0,0},
-          {0,0,0,0,0,0,0,0},
-          {0,0,0,0,0,0,0,0},
-          {0,0,0,0,0,0,0,0},
-          {0,0,0,0,0,0,0,0},
+          { {21,15, 0}, {10,13, 5}, {17, 9, 3}, {16,18,11}, {19, 1, 6}, { 2,12,23}, { 7,14, 4}, { 8,20,22} },
+          { { 5,23,20}, { 0,22,12}, {19,16,14}, { 7,17, 1}, { 4,11, 9}, {10, 8,15}, { 6, 3,18}, {21, 2,13} },
+          { { 1,17, 7}, {14,16,19}, { 0,12,22}, { 5,20,23}, {13, 2,21}, { 6,18, 3}, {15, 8,10}, { 4, 9,11} },
+          { {18,11,16}, { 9, 3,17}, { 5,10,13}, { 0,21,15}, {20,22, 8}, { 4, 7,14}, {12,23, 2}, { 6,19, 1} },
+          { { 4,19, 3}, { 6, 7,11}, {15, 2,20}, {13, 8,12}, { 0,10,23}, { 1,16, 9}, { 5,21,22}, {14,17,18} },
+          { {10, 2,22}, {21, 8,23}, { 4, 1,18}, { 6,14, 9}, { 7,16, 3}, { 0,13,20}, {19,17,11}, { 5,15,12} },
+          { { 6,14, 9}, { 4, 1,18}, {21, 8,23}, {10, 2,22}, { 5,15,12}, {19,17,11}, { 0,13,20}, { 7,16, 3} },
+          { {12, 8,13}, {20, 2,15}, { 6,11, 7}, { 4, 3,19}, {18,17,14}, { 5,22,21}, { 9,16, 1}, { 0,23,10} },
       };
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
@@ -142,7 +142,7 @@ public class TBPyraminxDiamond extends TablebasesAbstract
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
-  private int findIndex(int[] table, int entry)
+  private int findIndex1(int[] table, int entry)
     {
     int len = table.length;
 
@@ -152,6 +152,21 @@ public class TBPyraminxDiamond extends TablebasesAbstract
     return -1;
     }
 
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+  private int findIndex2(int[][] table, int entry)
+    {
+    int len = table.length;
+
+    for(int i=0; i<len; i++)
+      {
+      int[] t = table[i];
+      if( t[0]==entry || t[1]==entry || t[2]==entry ) return i;
+      }
+
+    return -1;
+    }
+
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
   public int[] getQuats(int index)
@@ -172,7 +187,7 @@ public class TBPyraminxDiamond extends TablebasesAbstract
     twist[5] = 2*(1-total_twist) + (total%2);
 
     for(int i=0; i<6; i++) quats[i  ] = CORNER_QUATS[i][twist[i]];
-    for(int i=0; i<8; i++) quats[i+6] = CENTER_QUATS[i][perm[i]];
+    for(int i=0; i<8; i++) quats[i+6] = CENTER_QUATS[i][perm[i]][0];
 
     return quats;
     }
@@ -184,8 +199,8 @@ public class TBPyraminxDiamond extends TablebasesAbstract
     int[] twist = new int[6];
     int[] perm  = new int[8];
 
-    for(int i=0; i<6; i++) twist[i] = findIndex(CORNER_QUATS[i],quats[i]);
-    for(int i=0; i<8; i++) perm[i]  = findIndex(CENTER_QUATS[i],quats[i]);
+    for(int i=0; i<6; i++) twist[i] = findIndex1(CORNER_QUATS[i],quats[i]);
+    for(int i=0; i<8; i++) perm[i]  = findIndex2(CENTER_QUATS[i],quats[i]);
 
     int centers_perm_num = TablebaseHelpers.computePermutationNum(perm);
     int total_twist = twist[0]+ 4*(twist[1]+ 4*(twist[2]+ 4*(twist[3]+ 4*(twist[4]+ 4*(twist[5]>1 ? 0:1)))));
