CharlesOBlack
Regular
- Joined
- Dec 27, 2008
- Messages
- 141
Right, it would. Though in this case it doesn't matter (we never change the value of m).
As I thought.
I'm getting good at this!
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.
Right, it would. Though in this case it doesn't matter (we never change the value of m).
map{$m=0|rand 6until($c+$b-5||$c-$m)&&$m-$b;print" ".(U,R,F,B,L,D)[$m].qw(' 2)[rand 3];$c=$b;$b=$m}1..25
for(int c=0,b=0,j=0,m;j<25;(m=rand()%6)-c|c+b-5&&b-m&&cout<<"URFBLD"[j++,c=b,b=m]<<" 2'"[rand()%3]<<" ");
$_.=chr rand 99,/[^URFBLD]|(.)\1|LRL|RLR|UDU|DUD|FBF|BFB/&&chop until/.{25}/;s/./" $&".qw(' 2)[rand 3]/ge;print
r=Math.random;for(c=b=j=0;j<25;c+b-5|c-m&&b-m?document.write("URFBLD"[j++,c=b,b=m]+" 2'"[0|r()*3]+" "):0)m=0|r()*6
p (x=y=0..25).map{z=x;x=(w=[%(UD),%(FB),%(RL)][rand 3])[rand 2] until x!=y||z!=x&&w[y];(y=x)+"2'"[rand 3].to_s}*" "
do{$_=join'',map{(U,R,F,B,L,D)[rand 6]}1..25}while/(.)\1|LRL|RLR|UDU|DUD|FBF|BFB/;print" $_".qw(' 2)[rand 3]for/./g
for($i=$b=$c=0;$i<25;$M="URFBLD 2'")if(($b-$m=rand()%6)&($c+$b-5|$c-$m))echo$M[$b=$m+0*$i++*$c=$b].$M[rand(6,8)].' '
from random import randint as r;c=b=0
for i in range(25):
m=r(0,5)
while (c+b-4 or c==m)and m==b:m=r(0,5)
print "URFBLD"[m]+" '2"[r(0,2)],;c=b;b=m
StringJoin[ToString[#]<>(c=RandomChoice)[{" ","' ","2 "}]&/@(Flatten[RandomSample[#,Ceiling[Random[]*5/4]]&/@c[{{U,R},{F,B},{L,D}},25]]//.{a___,b_,b_,c___}:>{a,b,c})]
for(c=b=j=0;j<25;c+b-5|c-m&&b-m?print("URFBLD"[j++,c=b,b=m]+" 2'"[rand(3)]+" "):0)m=rand(6)
from random import randint as r;c=b=0
for i in range(25):
m=r(0,5)
while not((c+b-5 or c-m)and m-b):m=r(0,5)
print "URFBLD"[m]+"'2"[r(0,1)],;c=b;b=m
for(int c=b=j=0,m;j<25;(m=rand()%6)-c|c+b-5&&b-m&&cout<<"URFBLD"[j++,c=b,b=m]<<" 2'"[rand()%3]<<" ");
I don't speak Python, but wouldn't this part cause the code to never produce clockwise turns?151 chars (including newlines)
Code:from random import randint as r;c=b=0 for i in range(25): m=r(0,5) while not((c+b-5 or c-m)and m-b):m=r(0,5) print "URFBLD"[m]+[B]"'2"[r(0,1)][/B],;c=b;b=m
C++:
possible? makes it 101 chars.
I don't speak Python, but wouldn't this part cause the code to never produce clockwise turns?
from random import randint as r;c=b=0
for i in range(25):
m=r(0,5)
while (c+b-4 or c==m)and m==b:m=r(0,5)
print "URFBLD"[m]+" '2"[r(0,2)],;c=b;b=m
perl: 107
Code:map{$m=int rand 6until($c+$b-5||$c-$m)&&$m-$b;print+(U,R,F,B,L,D)[$m].qw(' 2)[rand 3]." ";$c=$b;$b=$m}1..25
map{$m=0|rand 6until($c+$b-5||$c-$m)&&$m-$b;print+(U,R,F,B,L,D)[$m].qw(' 2)[rand 3]." ";$c=$b;$b=$m}1..25
Nope:
int c=b=j=0
if that was allowed we would have done it.
You can't do that in C++,
you have to declare a variable before you use it.
You need a C++ compiler if you want to start experimenting.
Ah, sorry. I should have mentioned this earlier; I thought the site was common knowledge. :/
EDIT: 100?
map{$m=0|rand 6until($c+$b-5|$c-$m)&&$m-$b;$c=$b;print" ".(U,R,F,B,L,D)[$b=$m].qw(' 2)[rand 3]}1..25
EDIT: 100?
map{$m=0|rand 6until($c+$b-5|$c-$m)&&$m-$b;$c=$b;print" ".(U,R,F,B,L,D)[$b=$m].qw(' 2)[rand 3]}1..25
That seems to work, but if it does, I'm surprised.
for(1..10000){map{$m=0|rand 6until($c+$b-5|$c-$m)&&$m-$b;if ($c+$b==5&&$m==$c) {print "NOPE"}$c=$b;" ".(U,R,F,B,L,D)[$b=$m].qw(' 2)[rand 3]}1..25}
map{$m=0|rand 6until$c+$b-5|$c-$m&&$m-$b;$c=$b;print" ".(U,R,F,B,L,D)[$b=$m].qw(' 2)[rand 3]}1..25
for(1..10000){map{$m=0|rand 6until$c+$b-5|$c-$m&&$m-$b;if ($c+$b==5&&$c==$m||$m==$b) {print "NOPE"}$c=$b;" ".(U,R,F,B,L,D)[$b=$m].qw(' 2)[rand 3]}1..25}
You shouldn't do $b=$m before $c=$b.