commit 7981e108b254781d566f957a89095bb56373ae0b
Author: leszek <leszek@koltunski.pl>
Date:   Mon Dec 2 23:48:04 2024 +0100

    3x3 Beginner should be finished. Everything seems to work, and work fast.

diff --git a/src/main/java/org/distorted/phasedsolver/SolverActivity.java b/src/main/java/org/distorted/phasedsolver/SolverActivity.java
index b5442a8..2e6189b 100644
--- a/src/main/java/org/distorted/phasedsolver/SolverActivity.java
+++ b/src/main/java/org/distorted/phasedsolver/SolverActivity.java
@@ -40,6 +40,7 @@ public class SolverActivity extends Activity
   private TextView mText;
   private SolvedObject mObject;
   private int[][] mMoveTable;
+  private int[][] mBasicAngles;
   private String mMoves;
   private int mNumMoves;
 
@@ -187,6 +188,7 @@ public class SolverActivity extends Activity
 
       mObject = new SolvedObject(pos,axis,angles,cuts,rot);
       mMoveTable = mObject.getMoveTable();
+      mBasicAngles = angles;
       }
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
@@ -194,11 +196,11 @@ public class SolverActivity extends Activity
     public void Solve(View v)
       {
       if( mObject==null ) createObject();
+      int[][] moveTable   = mObject.getMoveTable();
 
       TwistyObject object = getControl().getObject();
-      int[] numL      = object.getNumLayers();
-      float[][] pos   = object.getCubitPositions(numL);
-
+      int[] numL          = object.getNumLayers();
+      float[][] pos       = object.getCubitPositions(numL);
       int numCubits = pos.length;
       int[] qi = new int[numCubits];
       for(int i=0; i<numCubits; i++) qi[i] = object.getCubitQuatIndex(i);
@@ -207,25 +209,21 @@ public class SolverActivity extends Activity
       int[][] whiteCorners = new int[][]{ {0},{1},{2},{3} };
       int[][] secondLayer  = new int[][]{ {8},{9},{10},{11} };
 
-      int[][] algsSecondL  = { { 6, 3, 8, 3,15, 5,17}, {15, 5,17, 5, 6, 3, 8},
-                               {12, 3,14, 3, 8, 5, 6}, { 8, 5, 6, 5,12, 3,14},
-                               {11, 3, 9, 3,14, 5,12}, {14, 5,12, 5,11, 3, 9},
-                               {17, 3,15, 3, 9, 5,11}, { 9, 5,11, 5,17, 3,15},
-                               {3}
-                             };
-
-      int[][] algsEdgeOrie = { {11,17,5,15,3,9},{3} };
-      int[][] algsEdgePerm = { {6,5,8,5,6,4,8},{3} };
-      int[][] algsCornPerm = { {5,6,3,9,5,8,3,11},{3} };
-      int[][] algsCornOrie = { {15,2,17,0,15,2,17,0},{3} };
+      String a1 = "(3){-1,0,1,2}(6,3,8,3,15,5,17)";
+      String a2 = "(3){-1,0,1,2}(15,5,17,5,6,3,8)";
+      String a3 = "(3){-1,0,1,2}(12,3,14,3,8,5,6)";
+      String a4 = "(3){-1,0,1,2}(8,5,6,5,12,3,14)";
+      String a5 = "(3){-1,0,1,2}(11,3,9,3,14,5,12)";
+      String a6 = "(3){-1,0,1,2}(14,5,12,5,11,3,9)";
+      String a7 = "(3){-1,0,1,2}(17,3,15,3,9,5,11)";
+      String a8 = "(3){-1,0,1,2}(9,5,11,5,17,3,15)";
 
-      int[][] moveTable = mObject.getMoveTable();
       MoveProviderAll  all = new MoveProviderAll(moveTable);
-      MoveProviderAlgs asl = new MoveProviderAlgs(algsSecondL);
-      MoveProviderAlgs aeO = new MoveProviderAlgs(algsEdgeOrie);
-      MoveProviderAlgs aeP = new MoveProviderAlgs(algsEdgePerm);
-      MoveProviderAlgs acP = new MoveProviderAlgs(algsCornPerm);
-      MoveProviderAlgs acO = new MoveProviderAlgs(algsCornOrie);
+      MoveProviderAlgs asl = new MoveProviderAlgs(mObject, "["+a1+";"+a2+";"+a3+";"+a4+";"+a5+";"+a6+";"+a7+";"+a8+"]");
+      MoveProviderAlgs aeO = new MoveProviderAlgs(mObject, "(3){-1,0,1,2}(11,17,5,15,3,9)");
+      MoveProviderAlgs aeP = new MoveProviderAlgs(mObject, "(3){-1,0,1,2}(6,5,8,5,6,4,8){0,1}");
+      MoveProviderAlgs acP = new MoveProviderAlgs(mObject, "(3){-1,0,1,2}(5,6,3,9,5,8,3,11){0,1}");
+      MoveProviderAlgs acO = new MoveProviderAlgs(mObject, "(3){-1,0,1,2}(15,2,17,0){-2,0,2}");
 
       TargetProvider wcr = new TargetProviderAll(whiteCross);
       TargetProvider wco = new TargetProviderAll(whiteCorners);
@@ -276,11 +274,12 @@ public class SolverActivity extends Activity
     int findMove(int ax, int row, int angle)
       {
       int num = mMoveTable.length;
+      int basicAngle = mBasicAngles[ax][row];
 
       for( int m=0; m<num; m++)
         {
         int[] move = mMoveTable[m];
-        if( ax==move[0] && row==move[1] && angle==move[2] ) return m;
+        if( ax==move[0] && row==move[1] && ((angle-move[2])%basicAngle)==0 ) return m;
         }
 
       return -1;
