commit 3ca9729392928092a43e0161156eac65879b4386
Author: Leszek Koltunski <leszek@koltunski.pl>
Date:   Thu Jun 17 10:01:15 2021 +0200

    Correct rotations of the Pyraminx - eliminate one cse when three consecutive rotations collapse into one.

diff --git a/src/main/java/org/distorted/effects/scramble/ScrambleEffect.java b/src/main/java/org/distorted/effects/scramble/ScrambleEffect.java
index e7adca0d..c82f6a75 100644
--- a/src/main/java/org/distorted/effects/scramble/ScrambleEffect.java
+++ b/src/main/java/org/distorted/effects/scramble/ScrambleEffect.java
@@ -271,7 +271,7 @@ public abstract class ScrambleEffect extends BaseEffect implements EffectListene
     mBasicAngle = mObject.getBasicAngle();
 
     int numScrambles = cont.getNumScrambles();
-    int dura = (int)(duration*Math.pow(numScrambles,0.6f));
+    int dura = (int)(duration*Math.pow(numScrambles,0.66f));
     createBaseEffects(dura,numScrambles);
     createEffects    (dura,numScrambles);
 
diff --git a/src/main/java/org/distorted/objects/TwistyPyraminx.java b/src/main/java/org/distorted/objects/TwistyPyraminx.java
index 5c7ac81e..74cdae36 100644
--- a/src/main/java/org/distorted/objects/TwistyPyraminx.java
+++ b/src/main/java/org/distorted/objects/TwistyPyraminx.java
@@ -402,8 +402,24 @@ public class TwistyPyraminx extends TwistyObject
       }
     else
       {
-      int newVector = rnd.nextInt(NUM_AXIS -1);
+      int newVector = rnd.nextInt(NUM_AXIS-1);
       scramble[curr][0] = (newVector>=scramble[curr-1][0] ? newVector+1 : newVector);
+
+      // Correct the situation when we first rotate the largest layer, then a tip (which doesn't
+      // intersect anything besides the largest layer!) and then we try to rotate again along
+      // the same axis like 2 rotations before - which carries the risk we rotate the largest
+      // layer back to its spot again and the three moves end up being only a single tip rotation.
+      if( curr>=2 && scramble[curr-1][1]==(numLayers-1) && scramble[curr][0]==scramble[curr-2][0] )
+        {
+        for(int ax=0; ax<NUM_AXIS; ax++)
+          {
+          if( scramble[curr-1][0]!=ax && scramble[curr-2][0]!=ax )
+            {
+            scramble[curr][0]=ax;
+            break;
+            }
+          }
+        }
       }
 
     float rowFloat = rnd.nextFloat();
