274 bytes

its a world record, I guess. (until someone do it on perl...)

It works. copy and paste onto python interpreter. Or save it on a .py file.

You could also tweak it to generate a lot of scrambles:

just put a

in the beggining,

and in DOS do:

result:

EDIT:
first is 242 chars but is brute force.

second is 288 chars but is more pythonic.

its a world record, I guess. (until someone do it on perl...)

Code:

`c,a,l,f,g=__import__('random').choice,['FB','UD','RL'],[],lambda y:lambda x:x in y,lambda y:lambda x:x not in y;h=[l.append(c(filter(g(l[-1:]),c(filter(g(filter(f(a),[''.join(l[-2:][::x]) for x in [-1,1]])),a))))) for u in range(25)];print ' '.join([h+c(" '2",) for h in l])`

You could also tweak it to generate a lot of scrambles:

just put a

Code:

`for n in range(12):`

and in DOS do:

Code:

`scramble.py > output.txt`

file: output.txt

---------------------------------------------------------------------------------------

R' U2 D' L' R' D2 R2 U F B L' U B D F U' F' L' B' F' L' U2 D' R D2

B' U2 D2 F L R B' U2 D F' R F' R' B' F' R L2 D' B F D U R2 L2 U2

D2 U2 F L2 D F B' U D F B L' R' U' D' R2 F L2 D' U2 L2 B' R F U

L B' D U2 R2 B2 F' D' U2 L' F' B U' D F2 L' R B2 F2 U' D L' B U L'

F' U2 F2 B2 D' U L U2 B L B2 R F D2 R' U B2 L2 R' U2 D2 B U' L U

D U2 F U B2 L2 R U D2 R' U F' U L2 R B2 F' U R' D' B F' L' U L

R D2 U' R' F R L2 U' F' U' D' L2 D' B2 U' D' L R F2 D U2 F' B2 R L

D2 U' R U' L R F U' D R' U' F D R2 B' R' B2 R F' B2 U B F' L' U2

D2 U2 F B2 L' R2 U L2 U2 L2 D B' F U D' F B' D' U B' F' L D L' B'

D U' L' D' U' F' D' U2 L' R' B D2 F' B' L F' R' L2 F R U R B2 F U

EDIT:

Code:

```
from random import*;c=choice;w,l=['RL','UD','BF'],[]
for u in range(25):
a=c(w)
if sum([ord(x) for x in l[-2:]]) in [158,153,136]:
while l[-1] in a:a=c(w)
t=c(a)
while l[-1:]==[t]:t=c(a)
l=l+[t]
print ' '.join([x+c(" '2") for x in l])
============================================
from random import*;c=choice;w,l=['RL','UD','BF'],[]
def k():
m=[y.replace(l[-1],'') for y in w] if l[-1:] else w
h=[int(''.join(l[-2:]) in [x,x[::-1]]) for x in w]
if 1 in h:m.pop(h.index(1))
return m
for u in range(25):
l.append(c(c(k())))
print ' '.join([x+c(" '2") for x in l])
```

second is 288 chars but is more pythonic.

Last edited: Nov 12, 2010