# Thread: My python one-liner scramble generator

1. Odder.. edit your post =D

2. Originally Posted by Odder
Because of this line:
if n != o
you claim o=0 in the beginning, so n cannot be 0 for the first run, therefore you'll never get position 0 (R move) for the first move
Is that some weird Ruby stuff I don't know? I'd say n=m.at(rand(6)) never gets you n=0, just n="R". So that shouldn't be a problem.

3. I think so, because my original code generated scrambles beginning with R on multiple occasions.

4. Originally Posted by Stefan
Is that some weird Ruby stuff I don't know? I'd say n=m.at(rand(6)) never gets you n=0, just n="R". So that shouldn't be a problem.
Originally Posted by Owen
I think so, because my original code generated scrambles beginning with R on multiple occasions.
I'm no good at Ruby Ruby is retarded xD I'was god damn sure that rand(6) generated 0-5 -.-' (I generated like 30 scrambles without a leading R move :O )

EDIT:

Chen Shuang:
Code:
```U->L=25%
D->L=20%```

5. Originally Posted by Odder
I'was god damn sure that rand(6) generated 0-5
And it probably does. But the code says n=m.at(rand(6)), not n=rand(6).

6. Originally Posted by Stefan
And it probably does. But the code says n=m.at(rand(6)), not n=rand(6).
Ohh ****... Can you tell me the best place to hide? (I had already changed his code inside my head when I commented his code... stupid Odder)

7. Its algorithm can be describe as:
generate random moves
and then check it, let RR->R, LL->L, RL->LR, and UD, FB as well
is it really wrong?

8. Originally Posted by qq280833822
Its algorithm can be describe as:
generate random moves
and then check it, let RR->R, LL->L, RL->LR, and UD, FB as well
is it really wrong?
I'm pretty confident that I'm right. But I'm already looking for a place to hide when you prove me wrong.

(a=rand 6)!=b&&a!=b+3

same as:
a!=b and a!=b+3

well, a!=b is obvious..

a!=b+3 can be described like this:
setA=[U,R,F], setB=[D,L,B]
then we have: setA[x]+3=setB[x], where x is the position.
but setB[x]+3 != setA[x].... (as 5+3 != 2)
this means that for any moves in setA, there is 4 valid next-moves, but for setB we have 5.

The goal for the scrambles is to have:
5 valid moves, unless we have just had two opposite moves in a row, then it should be 4

9. why should valid moves of setA be the same as of setB
if we only allow "LR" but disallow "RL", of course setA is difference to setB...

10. Imagine you have the move R

R doesn't allow the next move to be L, therefore you can't get RL.. (RL is not converted to LR) (which leaves 4 valid moves only)

now take L

L does allow the next move to be R... (5 valid moves, YAY!! )