vcuber13
Veteran
does anyone know what to do here: http://www.speedsolving.com/forum/s...uestion-thread&p=484140&viewfull=1#post484140
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
For TI83/84:
Code::ClrHome :URFDLB '2→Str0 :0→E :7→D :For(A,1,6 :For(B,2,14,3 :E→F :D→E :While D=E or D=F :randInt(1,6→D :End :Output(A,B,sub(Str0,D,1)+sub(Str0,randInt(7,9),1 :End :End
:ClrHome
:"URFDLB '2"→Str0
:0→E
:7→D
:For(A,2,7
:For(B,2,14,3
:E→F
:D→E
:While D=E or D=F
:randInt(1,6→D
:End
:Output(A,B,sub(Str0,D,1)+sub(Str0,randInt(7,9),1
:End
:End
this didn't work for me.
I changed it to,
Code::ClrHome :"URFDLB '2"→Str0 :0→E :7→D :For(A,2,7 :For(B,2,14,3 :E→F :D→E :While D=E or D=F :randInt(1,6→D :End :Output(A,B,sub(Str0,D,1)+sub(Str0,randInt(7,9),1 :End :End
I guess you need "" around a string? also made it print from line 2 to 7 as the "Done" was overwriting the last move on the first line hah. Good job though I really like this.
Correct me if I'm wrong, but wouldn't Baian's 3x3 scrambler also prevent sequences like B L B'?
:Repeat D≠E and (D-3≠E or D+3≠E and D≠F
You can use parseInt() instead of Math.floor(). Saves two whole chars.
perl -le 'for(0..24){$a=int rand 6 until$a-$a[0]&&$a+$a[0]-5|$a-$a[1];@a=($a,@a)}print"@{[map{(U,F,R,L,B,D)[$_].(v39,2)[rand 3]}@a]}"'
A basic scrambler isn't much harder to write than a hello world. So yeah, it's been done in C and probably in <insert programming language here>.[abc]toshiro;484589 said:Imma start trying a scrambler in C. But it may take a while. I'm pretty busy here. (But did anyone do it already?)
JavaScript: You can use 0|x instead of Math.floor(x)
... and a-c instead of a!=c.
function r(n){if(n)return 0|Math.random()*n;for(d=b=j=c=a=4;j<29;)b=r(2)+1,a=r(3),a==c&&d&b||(d=a-c?b:d+b,c=a,j++,document.write(" RLFBUD"[a*2+b]+" 2'"[r(3)]+" " ))}
r=Math.random;for(d=b=j=c=a=4;j<29;)b=0|r()*2+1,a=0|r()*3,a==c&&d&b||(d=a-c?b:d+b,c=a,j++,document.write(" RLFBUD"[a*2+b]+" 2'"[0|r()*3]+" "))
Getting rid of the function altogether gets us down to 142 characters:
Code:r=Math.random;for(d=b=j=c=a=4;j<29;)b=0|r()*2+1,a=0|r()*3,a==c&&d&b||(d=a-c?b:d+b,c=a,j++,document.write(" RLFBUD"[a*2+b]+" 2'"[0|r()*3]+" "))
Just 5 more (less) characters and it's down to half of OP.![]()
r=Math.random;for(d=b=j=c=a=4;j<29;)b=0|r()*2+1,a=0|r()*3,a==c&&d&b||(d=a-c?b:d+b,c=a,j++,document.write(" RLFBUD"[a*2+b]+" 2'"[0|r()*3]))
r=Math.random;for(c=b=j=0;j<25;)m=0|r()*6,c+b==5&&c==m||b==m|(c=b,b=m,j++,document.write("URFBLD"[m]+" 2'"[0|r()*3]+" "))
<body onload='r=Math.random;for(c=b=j=0;j<25;)m=0|r()*6,c+b==5&&c==m||b==m||(c=b,b=m,j++,document.write("URFBLD"[m]+" 2'"[0|r()*3]+" "))'>
Changed around the code for a more efficient setup. 122 characters.
Code:r=Math.random;for(c=b=j=0;j<25;)m=0|r()*6,c+b==5&&c==m||b==m|(c=b,b=m,j++,document.write("URFBLD"[m]+" 2'"[0|r()*3]+" "))
<script>r=Math.random;for(c=b=j=0;j<25;)m=0|r()*6,c+b==5&&c==m||b==m||(c=b,b=m,j++,document.write("URFBLD"[m]+" 2'"[0|r()*3]+" "))</script>