commit d88629343d9a17215839a09a7ee78d1296ae02f8
Author: Leszek Koltunski <leszek@koltunski.pl>
Date:   Wed Nov 3 01:10:57 2021 +0100

    Fix the solver (after rearranging the faces of the cuboids)

diff --git a/src/main/java/org/distorted/solvers/SolverMain.java b/src/main/java/org/distorted/solvers/SolverMain.java
index 02a1d714..513e28cf 100644
--- a/src/main/java/org/distorted/solvers/SolverMain.java
+++ b/src/main/java/org/distorted/solvers/SolverMain.java
@@ -101,6 +101,26 @@ public class SolverMain implements Runnable
       }
     }
 
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+  private int mapCubitToFace(int cubit, int face)
+    {
+    if( cubit<8 ) return face;
+    if( cubit>19) return 4;
+
+    switch(face)
+      {
+      case 0: return cubit==15 || cubit==18 ? 3 : 5;
+      case 1: return cubit==13 || cubit==16 ? 3 : 5;
+      case 2: return cubit==10              ? 5 : 3;
+      case 3: return cubit== 8              ? 3 : 5;
+      case 4: return cubit== 9              ? 3 : 5;
+      case 5: return cubit== 8              ? 5 : 3;
+      }
+
+    return -1;
+    }
+
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 // order: Up --> Right --> Front --> Down --> Left --> Back
 // (because the first implemented Solver - the two-phase Cube3 one - expects such order)
@@ -130,32 +150,38 @@ public class SolverMain implements Runnable
 
     for(int i=0; i<9; i++)
       {
-      int color = mObject.getCubitFaceColorIndex(U_INDEX[i], i==4 ? F : U);
+      int face = mapCubitToFace(U_INDEX[i],U);
+      int color = mObject.getCubitFaceColorIndex(U_INDEX[i], face);
       objectString.append(FACE_NAMES[color]);
       }
     for(int i=0; i<9; i++)
       {
-      int color = mObject.getCubitFaceColorIndex(R_INDEX[i], i==4 ? F : R);
+      int face = mapCubitToFace(R_INDEX[i],R);
+      int color = mObject.getCubitFaceColorIndex(R_INDEX[i], face);
       objectString.append(FACE_NAMES[color]);
       }
     for(int i=0; i<9; i++)
       {
-      int color = mObject.getCubitFaceColorIndex(F_INDEX[i], i==4 ? F : F);
+      int face = mapCubitToFace(F_INDEX[i],F);
+      int color = mObject.getCubitFaceColorIndex(F_INDEX[i], face);
       objectString.append(FACE_NAMES[color]);
       }
     for(int i=0; i<9; i++)
       {
-      int color = mObject.getCubitFaceColorIndex(D_INDEX[i], i==4 ? F : D);
+      int face = mapCubitToFace(D_INDEX[i],D);
+      int color = mObject.getCubitFaceColorIndex(D_INDEX[i], face);
       objectString.append(FACE_NAMES[color]);
       }
     for(int i=0; i<9; i++)
       {
-      int color = mObject.getCubitFaceColorIndex(L_INDEX[i], i==4 ? F : L);
+      int face = mapCubitToFace(L_INDEX[i],L);
+      int color = mObject.getCubitFaceColorIndex(L_INDEX[i], face);
       objectString.append(FACE_NAMES[color]);
       }
     for(int i=0; i<9; i++)
       {
-      int color = mObject.getCubitFaceColorIndex(B_INDEX[i], i==4 ? F : B);
+      int face = mapCubitToFace(B_INDEX[i],B);
+      int color = mObject.getCubitFaceColorIndex(B_INDEX[i], face);
       objectString.append(FACE_NAMES[color]);
       }
 
