Message #1685

From: Melinda Green <>
Subject: Introducing MC4D build 181
Date: Wed, 11 May 2011 22:12:00 -0700

Dear cubists,

Has it really been a year and a half since we touched the code? It
appears so. This version simply implements David Smith’s near little
Goldilocks function for calculating a good number of scrambling twists
for all puzzles. You will find the new featured version here:


Please try it out with your favorite puzzles and let us know if you see
any problems. If it looks good in a few days, I’ll make the "Download"
button point to it. The only problem you would even see would be if
there were too few scrambles, but you can look at the resulting log
files to see the number used, or simply run it from a command window
where it will print out the value used for each full scramble.

For the record, here is my Java implementation as some of you might like
to adapt and test with other puzzles:

public int goldilocks(int nPieces, int nFaces, int nStickers, int
n1CPieces, int d) {
double dpieces = nPieces, dfaces = nFaces, dstickers = nStickers,
d1cpieces = n1CPieces;
double aveNumTwists = (dpieces * dfaces / ((double)dstickers -
d1cpieces)) * (0.577 + Math.log(dpieces));
return (int)Math.round(aveNumTwists * (d - 1 + log4(dfaces / (2.0 *

private double log4(double x) {
return Math.log(x) / Math.log(4);

It may be too much to expect for one function to handle every possible
twisty puzzle, and David has already described some of its limitations,
but this is a noble goal to aspire to, so maybe over time will have a
fully general, well tested and reasonably simple solution. Regardless of
how far David’s first shipping version takes us towards that goal, it is
definitely light years ahead of my original hack.

Thank you David!!