• Welcome to the Speedsolving.com, home of the web's largest puzzle community!
    You are currently viewing our forum as a guest which gives you limited access to join discussions and access our other features.

    Registration is fast, simple and absolutely free so please, join our community of 40,000+ people from around the world today!

    If you are already a member, simply login to hide this message and begin participating in the community!

Scramble generating scripts/algorithms?

Gerra

Member
Joined
Jan 13, 2010
Messages
20
Hi there, I'm interested on finding any resources that can guide me trough scramble generating.

I want to write a scramble generator script for a lot of puzzle types. Where can I find a good starting point?

I think they are something more difficult that simple random numbers.

Isn't speedsolving the best place to ask this question?
 
Last edited by a moderator:

Lucas Garron

Administrator
Joined
Jul 6, 2007
Messages
3,718
Location
California
WCA
2006GARR01
YouTube
Visit Channel
What's the purpose, and what language do you want to use?
It's fine to ask in speedsolving, but you should ask a more specific question if you want a useful answer.

Look through the software area to see what you need.

Mark 2, https://github.com/jfly/tnoodle, and PPT have various pieces of sample code for good scramblers.

Jaap's page has a lot of good math explanations.
 

Gerra

Member
Joined
Jan 13, 2010
Messages
20
Whoa, you're the guy who made CCT?
Did a great job! Really. Thanks for the response, my pleasure.

Generating scrambles seems too difficult for my timeframe. Or maybe the reason behind the huge codes here - https://github.com/lgarron/mark2/tree/master/inc/scramblers - is the visual display? I'm makin' a timer, and I need only the literal scrambles.

I'll use predefined scrambles for now, or maybe we can collaborate on my project, if interested. I've seen you have C experience as well, I'll drop you a mail in private.
 

qqwref

Member
Joined
Dec 18, 2007
Messages
7,834
Location
a <script> tag near you
WCA
2006GOTT01
YouTube
Visit Channel
Nope, Lucas made Mark 2, but Jeremy Fleischman (and Ryan Zheng) made CCT.

If you want simpler scrambles, you might want to take a look at the code in http://mzrg.com/qqtimer/. The "megascramble" function is a little hard to understand, but it's very general. A typical 3x3x3 scrambler would work something like this:
- Generate a sequence of L, R, U, D, F, B moves, such that (a) the same move doesn't occur twice in a row, and (b) there are no sequences such as "U D U" where the same move gets repeated without changing "axis".
- For each move, add a suffix to specify a random amount of that move. So, for R, we randomly choose between R, R', and R2.
The megascramble function basically generates random moves just like this, and you can specify which moves are in each axis group as well as which suffixes are allowed. Of course, you can just make a separate scramble function for each puzzle if you want. The main idea is to generate random moves that don't have cancellations.

A lot of modern programs have much more complicated scramblers, which choose a random position and generate a short sequence that solves it. Many of them also have functions to create images (I think all of the Mark 2 and CCT ones do this). Depending on what you want, you can save a lot of space and complexity by getting rid of those features.
 

tim

Member
Joined
Nov 22, 2006
Messages
1,692
Location
Karlsruhe, Germany
WCA
2007HABE01
YouTube
Visit Channel
Generating scrambles seems too difficult for my timeframe. Or maybe the reason behind the huge codes here - https://github.com/lgarron/mark2/tree/master/inc/scramblers - is the visual display? I'm makin' a timer, and I need only the literal scrambles.

If you're making a timer in Ruby (or JRuby/whatever), feel free to use this: https://github.com/timhabermaas/scrambler (not random-state, though)

I've also made a tiny(!) API around it: http://scrambler-api.herokuapp.com/3x3x3 (Code). Feel free to fork it and adapt it to your needs.
 
Top