# Need help with a semi-advanced Square-1 scrambler



## Shiv3r (Mar 3, 2017)

Hey guys, I am looking for some coding help. 
I am a decent coder, but I have found this to be a little over my head. What I need is a square-1 scrambler that gives me Cubeshape at the end everytime(and if it's easier, no parity). But what I really need is a scrambler that will give me cubeshape and the 2 "roux" blocks solved on D(the whole D layer solved minus DF and DB). It can stay in cubeshape, and therefore not ever give parity if that makes it easier to code. Anyone here have enough expertise to help me out? 
Thanks,
Shiv3r


----------



## xyzzy (Mar 4, 2017)

There are two main ways of going about this.

One is to generate the state directly (generate a random permutation for the four corners and six edges, along with randomly deciding whether to flip the middle layer) and use a solver to solve it. Depending on which language you intend to use, you might have to write your own squan solver to do this.

If you do take the route of writing your own sq-1 solver (assuming CSP is always solved), it might help to note that there are two "shapes" you need to keep track of: whether it's a (-1,0) away from solved or a (0,1) away from solved. Rather than considering /, U and D as the three types of moves, it could help to think of U, D, slicing at the (1,0) state and slicing at the (0,-1) state to be four types of moves, and once the solver has generated a solution in terms of these moves, you can convert it back to the standard sq-1 notation.

The other way is to hard-code algs for all the cases, and concatenate algs for the different steps to get your scramble. The downside is that your scramble sequences might end up quite long.


----------



## EMI (Mar 4, 2017)

Here's a very simple command-line solver for Windows:
https://www.jaapsch.net/puzzles/square1.htm
(The optimal one)
I'm not much of an expert, but you can probably write a program to list all 6!*3!=4320 cases (ignoring AUF) as strings (format as described in the readme) and write them into a file inputs.txt seperated by newlines.
Then run the solver to solve all of them using
sq1optim -n -iinputs.txt -v0 >resultfile.txt
This will redirect the output into a new file resultfile.txt in Windows.
Now all you have to do is select a random line in the file.
On my PC, the solver takes about one second per position, so for all the positions it should take about an hour or so.

Edit: I tried it myself, attached the scrambles. The UFR corner will always be solved.


----------



## Shiv3r (Mar 4, 2017)

EMI said:


> Here's a very simple command-line solver for Windows:
> https://www.jaapsch.net/puzzles/square1.htm
> (The optimal one)
> I'm not much of an expert, but you can probably write a program to list all 6!*3!=4320 cases (ignoring AUF) as strings (format as described in the readme) and write them into a file inputs.txt seperated by newlines.
> ...


is this with the roux blocks?


----------



## EMI (Mar 5, 2017)

Shiv3r said:


> is this with the roux blocks?



Yes, these are the optimal algs for all 4320 cases (except solved)


----------

