# Message #1722

From: David Smith <djs314djs314@yahoo.com>

Subject: Re: [MC4D] Introducing MC4D build 181

Date: Mon, 16 May 2011 05:47:30 -0700

Thanks for releasing this Melinda! And I appreciate the compliments! I’m glad

to be of help anytime.

I should note to everyone that the base-4 logarithm can be changed to a base-2,

or possibly base-3. The lower the base, the more a particular puzzle is scrambled,

but all with reasonable ranges. And if Roice desires it, I could hopefully come up

with something similar for MagicTile.

I’m not certain at this point how I could improve the function, but with feedback

hopefully it will eventually be refined to be acceptable for all puzzles. Of course,

whether Andrey or Roice want to modify their code is entirely up to them, regardless

of how well my function works. I did some 6 and 7-dimensional cube calculations,

and the results appeared accurate; not far too high or far too low, from my intuitive

point of view.

Thanks Melinda, and if you need further assistance you know where to find me! :)

It might be a couple of weeks before I get back to the wiki, but I’m still planning to

complete that project.

All the best,

David

— On Thu, 5/12/11, Melinda Green <melinda@superliminal.com> wrote:

From: Melinda Green <melinda@superliminal.com>

Subject: [MC4D] Introducing MC4D build 181

To: "MagicCube4D" <4D_Cubing@yahoogroups.com>

Date: Thursday, May 12, 2011, 1:12 AM

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:

http://magiccube4d.googlecode.com/files/mc4d-4.0.181.jar

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 *
```

d))));

}

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!!

-Melinda