commit 6f1dbce1aac0057eeeb3a81ca82a3656680f16ef
Author: Leszek Koltunski <leszek@koltunski.pl>
Date:   Sun Mar 12 17:45:02 2023 +0100

    2x2 solver class finished.

diff --git a/src/main/java/org/distorted/solvers/SolverCube2.java b/src/main/java/org/distorted/solvers/SolverCube2.java
index 706a7cfa..a463e55e 100644
--- a/src/main/java/org/distorted/solvers/SolverCube2.java
+++ b/src/main/java/org/distorted/solvers/SolverCube2.java
@@ -40,7 +40,14 @@ public class SolverCube2 extends SolverTablebase
 
   private void fillCornerTwists(int[] output, int[][] corners, int[] perm)
     {
-    // TODO
+    for(int i=0; i<8; i++)
+      {
+      int[] c = corners[perm[i]];
+
+           if( c[0]==mFaceColors[0] || c[0]==mFaceColors[1] ) output[i] = 0;
+      else if( c[1]==mFaceColors[0] || c[1]==mFaceColors[1] ) output[i] = 1;
+      else                                                    output[i] = 2;
+      }
     }
 
 ////////////////////////////////////////////////////////////////////////////////////////
@@ -78,14 +85,14 @@ public class SolverCube2 extends SolverTablebase
     output[6] = cornerIndex(corners, 0,3,5);
     output[7] = cornerIndex(corners, 0,4,3);
 
-    if( output[0]==-1 ) { android.util.Log.e("D ", "135"); return ERROR_CORNER_135_MISSING; }
-    if( output[1]==-1 ) { android.util.Log.e("D ", "134"); return ERROR_CORNER_134_MISSING; }
-    if( output[2]==-1 ) { android.util.Log.e("D ", "125"); return ERROR_CORNER_125_MISSING; }
-    if( output[3]==-1 ) { android.util.Log.e("D ", "124"); return ERROR_CORNER_124_MISSING; }
-    if( output[4]==-1 ) { android.util.Log.e("D ", "035"); return ERROR_CORNER_035_MISSING; }
-    if( output[5]==-1 ) { android.util.Log.e("D ", "034"); return ERROR_CORNER_034_MISSING; }
-    if( output[6]==-1 ) { android.util.Log.e("D ", "025"); return ERROR_CORNER_025_MISSING; }
-    if( output[7]==-1 ) { android.util.Log.e("D ", "024"); return ERROR_CORNER_024_MISSING; }
+    if( output[0]==-1 ) return ERROR_CORNER_125_MISSING;
+    if( output[1]==-1 ) return ERROR_CORNER_124_MISSING;
+    if( output[2]==-1 ) return ERROR_CORNER_135_MISSING;
+    if( output[3]==-1 ) return ERROR_CORNER_134_MISSING;
+    if( output[4]==-1 ) return ERROR_CORNER_025_MISSING;
+    if( output[5]==-1 ) return ERROR_CORNER_024_MISSING;
+    if( output[6]==-1 ) return ERROR_CORNER_035_MISSING;
+    if( output[7]==-1 ) return ERROR_CORNER_034_MISSING;
 
     return 0;
     }
@@ -118,8 +125,6 @@ public class SolverCube2 extends SolverTablebase
     mFaceColors[3] = findColor(corners,mFaceColors[4],mFaceColors[1]);
     mFaceColors[5] = findColor(corners,mFaceColors[1],mFaceColors[2]);
 
-    for(int i=0; i<6; i++) android.util.Log.e("D", "face "+i+" : "+mFaceColors[i]);
-
     for(int i=0; i<6; i++)
       {
       int color = mFaceColors[i];
@@ -177,13 +182,7 @@ public class SolverCube2 extends SolverTablebase
     corners[7][0] = object.getCubitFaceStickerIndex(7,1);
     corners[7][1] = object.getCubitFaceStickerIndex(7,3);
     corners[7][2] = object.getCubitFaceStickerIndex(7,5);
-/*
-    for(int i=0; i<8; i++)
-      for(int f=0; f<3; f++)
-        {
-        android.util.Log.e("D", "cubit "+i+" face "+f+" : "+corners[i][f]);
-        }
-*/
+
     int result0 = computeFaceColors(corners);
     if( result0<0 ) return result0;
 
@@ -202,18 +201,6 @@ public class SolverCube2 extends SolverTablebase
     perm[6] = corner_perm[7]>1 ? corner_perm[7]-1 : corner_perm[7];
 
     int perm_num = TablebaseHelpers.computePermutationNum(perm);
-/*
-    android.util.Log.e("D", "corner perm num="+perm_num);
-
-    for(int i=0; i<8; i++)
-      {
-      android.util.Log.e("D", "8perm "+i+" "+corner_perm[i]);
-      }
-    for(int i=0; i<7; i++)
-      {
-      android.util.Log.e("D", "7perm "+i+" "+perm[i]);
-      }
-*/
     int[] twist = new int[8];
     fillCornerTwists(twist,corners,corner_perm);
 
@@ -234,8 +221,8 @@ public class SolverCube2 extends SolverTablebase
       {
       case 0: return R.string.color_yellow4;
       case 1: return R.string.color_white4;
-      case 2: return R.string.color_green4;
-      case 3: return R.string.color_blue4;
+      case 2: return R.string.color_blue4;
+      case 3: return R.string.color_green4;
       case 4: return R.string.color_red4;
       case 5: return R.string.color_orange4;
       }
@@ -251,8 +238,8 @@ public class SolverCube2 extends SolverTablebase
       {
       case 0: return R.string.color_yellow3;
       case 1: return R.string.color_white3;
-      case 2: return R.string.color_green3;
-      case 3: return R.string.color_blue3;
+      case 2: return R.string.color_blue3;
+      case 3: return R.string.color_green3;
       case 4: return R.string.color_red3;
       case 5: return R.string.color_orange3;
       }
