commit 46a961fd5ebb23ac3d7363712fd9e7ce347dea3a
Author: Leszek Koltunski <leszek@koltunski.pl>
Date:   Wed Apr 8 23:13:29 2020 +0100

    The 3x3x3 Solver finished - here the last piece of work, locking the centers of the 3x3x3 cube in place so that RubikStateSolver's color picker cannot change them ( the CUBE3 solver assumes this )

diff --git a/src/main/java/org/distorted/main/RubikSurfaceView.java b/src/main/java/org/distorted/main/RubikSurfaceView.java
index 408e0ecc..568caa6d 100644
--- a/src/main/java/org/distorted/main/RubikSurfaceView.java
+++ b/src/main/java/org/distorted/main/RubikSurfaceView.java
@@ -31,6 +31,7 @@ import org.distorted.library.type.Static3D;
 import org.distorted.library.type.Static4D;
 import org.distorted.objects.RubikObject;
 import org.distorted.objects.RubikObjectMovement;
+import org.distorted.solvers.SolverMain;
 import org.distorted.states.RubikState;
 import org.distorted.states.RubikStateSolver;
 import org.distorted.states.RubikStateSolving;
@@ -72,6 +73,7 @@ public class RubikSurfaceView extends GLSurfaceView
     private float mStartRotX, mStartRotY;
     private float mAxisX, mAxisY;
     private float mRotationFactor;
+    private int mLastCubitColor, mLastCubitFace, mLastCubit;
 
     private static Static4D mQuatCurrent    = new Static4D(0,0,0,1);
     private static Static4D mQuatAccumulated= new Static4D(-0.25189602f,0.3546389f,0.009657208f,0.90038127f);
@@ -205,13 +207,13 @@ public class RubikSurfaceView extends GLSurfaceView
             if( down )
               {
               RubikStateSolver solver = (RubikStateSolver) RubikState.SVER.getStateClass();
-              int face      = mMovement.getTouchedFace();
+              mLastCubitFace = mMovement.getTouchedFace();
               float[] point = mMovement.getTouchedPoint3D();
               int color = solver.getCurrentColor();
               RubikObject object = mPostRender.getObject();
-              int cubit = object.getCubit(point);
-
-              mPostRender.setTextureMap( cubit, face, color );
+              mLastCubit = object.getCubit(point);
+              mPostRender.setTextureMap( mLastCubit, mLastCubitFace, color );
+              mLastCubitColor = SolverMain.cubitIsLocked(object.getObjectList(), object.getSize(), mLastCubit);
               }
             }
           }
@@ -413,6 +415,10 @@ public class RubikSurfaceView extends GLSurfaceView
                                          {
                                          mPostRender.finishRotation();
                                          }
+                                       if( mLastCubitColor>=0 )
+                                         {
+                                          mPostRender.setTextureMap( mLastCubit, mLastCubitFace, mLastCubitColor );
+                                         }
                                        break;
          }
 
diff --git a/src/main/java/org/distorted/solvers/SolverMain.java b/src/main/java/org/distorted/solvers/SolverMain.java
index 86dd4723..486bdc4a 100644
--- a/src/main/java/org/distorted/solvers/SolverMain.java
+++ b/src/main/java/org/distorted/solvers/SolverMain.java
@@ -45,6 +45,27 @@ public class SolverMain implements Runnable
     mObjectPosition = position;
     }
 
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// certain objects have certain cubits locked - for example, the Cube3's centers of
+// sides always have the same color.
+// If a certain cubit is locked, return the color (index into it's FACE_COLORS array) it
+// must have. Otherwise return -1.
+
+  public static int cubitIsLocked(RubikObjectList object, int size, int cubit)
+    {
+    if( object == RubikObjectList.CUBE && size == 3)
+      {
+      if( cubit==21 ) return 0; // center of the right  face
+      if( cubit== 4 ) return 1; // center of the left   face
+      if( cubit==15 ) return 2; // center of the up     face
+      if( cubit==10 ) return 3; // center of the bottom face
+      if( cubit==13 ) return 4; // center of the front  face
+      if( cubit==12 ) return 5; // center of the back   face
+      }
+
+    return -1;
+    }
+
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
   private void solveCube3(RubikStateSolver solver)
