# Java Scrambler



## Michiel van der Blonk (Oct 10, 2010)

I wrote a tiny scrambler application in Java (3x3 only). Check it out: http://www.vanderblonk.com/wp-content/uploads/rubiks-cube-scramble-generator.zip

New: generates N scrambles of length L
Show: shows animated java applet for last scramble or selected text
Clear: clear list

Source code is in the zip file.

Hope you like it. The nice thing about the scramble routine is that it doesn't use a while loop to prevent cancelled moves...


----------



## oprah62 (Oct 11, 2010)

Thanks! I appreciate this because now I can just print out lists. Thank you.


----------



## Michiel van der Blonk (Oct 12, 2010)

update : I made a javascript version using the same code (well not entirely the same of course).

http://vanderblonk.com/cube/scrambler/

Works best in Chrome (resizes the applet in the window).


----------



## CharlesOBlack (Oct 12, 2010)

Michiel van der Blonk said:


> update : I made a javascript version using the same code (well not entirely the same of course).
> 
> http://vanderblonk.com/cube/scrambler/
> 
> Works best in Chrome (resizes the applet in the window).


 
This is awesome.

Thanks, Michiel!


----------



## dillonbladez (Oct 13, 2010)

Amazing! 
Can produce 500 scrambles, no problem, and within 3 seconds (Estimate). Impressive!
Now if only there was one for square 1...


----------



## NeedReality (Oct 13, 2010)

For some reason I get an error when trying to use the Java version, but the JavaScript one is great. Thanks!


----------



## CubesOfTheWorld (Oct 13, 2010)

When I download it and extract the files, it does nothing. I'm so stupid :fp

EDIT: To tell you guys what I am doing to make it easier for figure out the problem (I am using Google Chrome): I click on the link in the first post. The newly downloaded zip file shows up at the bottom of the Chrome window. I click on that, which brings up the file on the "downloads" section of my computer. At the top of that window I press "Extract all files". When the extraction window appears, I click extract files. The exact same "downloads" window pops up again, the only difference is that there is no "Extract all files" button at the top of the window. That button was replaced with a "Burn" button. If I click on the "dist" or "src" folders, it just brings me to a bunch of other folders, and so on.


----------



## MichaelP. (Oct 13, 2010)

Could you make a print function?

EDIT: Actually, I can probably just copy and paste it into word. It would be nice though.


----------



## Stefan (Oct 13, 2010)

"Unable to launch the application."


Spoiler



com.sun.deploy.net.FailedDownloadException: Unable to load resource: *file:/C:/Users/Michiel*/Documents/NetBeansProjects/Algopher/dist/launch.jnlp
at com.sun.deploy.net.DownloadEngine.actionDownload(Unknown Source)
at com.sun.deploy.net.DownloadEngine.getCacheEntry(Unknown Source)
at com.sun.deploy.net.DownloadEngine.getCacheEntry(Unknown Source)
at com.sun.deploy.net.DownloadEngine.getResourceCacheEntry(Unknown Source)
at com.sun.deploy.net.DownloadEngine.getResourceCacheEntry(Unknown Source)
at com.sun.deploy.net.DownloadEngine.getResource(Unknown Source)
at com.sun.deploy.net.DownloadEngine.getResource(Unknown Source)
at com.sun.javaws.Launcher.updateFinalLaunchDesc(Unknown Source)
at com.sun.javaws.Launcher.prepareToLaunch(Unknown Source)
at com.sun.javaws.Launcher.prepareToLaunch(Unknown Source)
at com.sun.javaws.Launcher.launch(Unknown Source)
at com.sun.javaws.Main.launchApp(Unknown Source)
at com.sun.javaws.Main.continueInSecureThread(Unknown Source)
at com.sun.javaws.Main$1.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)





Michiel van der Blonk said:


> The nice thing about the scramble routine is that it doesn't use a while loop to prevent cancelled moves...


Does that matter? 

Also, what advantage does your offer? I mean, considering all the other scrambles we already have.



Michiel van der Blonk said:


> http://vanderblonk.com/cube/scrambler/


 
Um... it gave me this:
*F2 B F2* L D' R U' F2 U L U' L2 R F R D U R' L D2 F D2 R2 L U



MichaelP. said:


> Could you make a print function?


If you just want to print a lot of scrambles, there's also this (reload to get new scrambles):
http://stefan-pochmann.info/spocc/other_stuff/tools/scramble3x3/
Or the one below, if you don't care about formatting.



dillonbladez said:


> Amazing!
> Can produce 500 scrambles, no problem, and within 3 seconds (Estimate). Impressive!


You must not be a programmer. Try this:
http://stefan-pochmann.info/ptimer/500scrambles.html
How long does that take for you?


----------



## Michiel van der Blonk (Oct 15, 2010)

Stefan, I noticed the error quite soon, but was busy fixing it and adding features instead of checking the forum to see if anyone had spotted the problem. I should've known you would be the first. Anyway, it's fixed and I added an option for a generated visualcube image that shows the scramble. I still have some problems getting that to work in IE though, but it feels pointless to solve that.

As to what's the point, there is no point, just that I was fiddling with Java. Also, not using a while loop matters to me, so it matters, just because I say so. :-D

So I guess I should now convert it to C to see how fast it would churn out algorithms, and then assembly... Well, maybe not..

Oh, and my scrambler doesn't add anything that your scrambler doesn't do I guess. I started it because I wanted a mobile application that gave me scrambles. Do you know of any other that run on regular Java (J2ME so not Android, Iphone, Crackberry etc)?


----------



## qqwref (Oct 15, 2010)

I have a more functional Javascript scrambler at http://mzrg.com/miniSites/scramblers/megascrambler.html, but yours is pretty cool. Mine is old though and at some point I should update it with the latest scramblers in qqTimer.


----------



## Stefan (Oct 15, 2010)

Michiel van der Blonk said:


> So I guess I should now convert it to C to see how fast it would churn out algorithms



Are you serious? You think generating the algs is a bottleneck? Note how even my simple javascript scrambler produces 500 scrambles pretty much instantly.



Michiel van der Blonk said:


> Do you know of any other that run on regular Java (J2ME so not Android, Iphone, Crackberry etc)?



I think this one does (haven't tried it myself):
http://m.cubing.dk/


----------



## hr.mohr (Oct 15, 2010)

Stefan said:


> I think this one does (haven't tried it myself):
> http://m.cubing.dk/


 
Most scramblers in that program is the code from jnetcube  tweaked to run in J2ME.


----------



## RCTACameron (Oct 15, 2010)

The javascript applet is really nice, and this will make it sooooo much easier to print out long lists of scrambles. Thanks, I'll be using it!


----------



## mrCage (Oct 15, 2010)

qqwref said:


> I have a more functional Javascript scrambler at http://mzrg.com/miniSites/scramblers/megascrambler.html, but yours is pretty cool. Mine is old though and at some point I should update it with the latest scramblers in qqTimer.


 
I like the 3x3x3 noobs scrambler!

On the serious side, sometimes a client side scrambler is better, and sometimes a server side one fits the bill better (online competitions for instance)...

Per


----------



## qqwref (Oct 15, 2010)

Per: Server side might be useful for very computation-intensive scrambling, like (near-)optimal 3x3 or Square-1. For online competitions, it would probably be best to generate a static page (with the scrambles) ahead of time, and then have the competitors load that.

Stefan: Scrambling algs themselves are certainly not a bottleneck in 3x3 (at least with random moves), but they definitely can be in other cases, such as CubeExplorer type 3x3, optimal 2x2/pyraminx, some bandaged puzzles, etc.


----------



## deepSubDiver (Oct 15, 2010)

dillonbladez said:


> [...] Now if only there was one for square 1...


 http://83.169.19.211/sq1/
Enjoy


----------



## Michiel van der Blonk (Oct 15, 2010)

Stefan said:


> Are you serious? You think generating the algs is a bottleneck? Note how even my simple javascript scrambler produces 500 scrambles pretty much instantly.
> 
> I think this one does (haven't tried it myself):
> http://m.cubing.dk/



No, I am not serious. I knew it would tick you off. No way I am going to program C (maybe never again). 
Thanks, I'll try it, it looks good.


----------



## Lucas Garron (Oct 17, 2010)

deepSubDiver said:


> http://83.169.19.211/sq1/
> Enjoy


 
Discussion moved here.


----------



## dillonbladez (Oct 17, 2010)

Stefan said:


> You must not be a programmer. Try this:
> http://stefan-pochmann.info/ptimer/500scrambles.html
> How long does that take for you?



No, i'm not a programmer... 
:O.... too fast....


----------

