Ruby (1.9):
Code:
turns = [%w{R L}, %w{F B}, %w{D U}]
axis = rand t.size
output = (1..25).map do
axis = (axis + rand(turns.size - 1) + 1) % turns.size
t[axis].sample + ['', "'", '2'].sample
end.join(' ')
p output
That's 199 characters and it's still readable and pretty generic (it can be used to generate scrambles for cubes of all sizes).
After obfuscating it a bit, i got it down to 111 characters:
Code:
a=rand 3
o=(1..25).map{a=(a+rand(2)+1)%3;[%w{R L},%w{F B},%w{D U}][a].sample+['',"'",'2'].sample}.join(' ')
p o
Using p instead of puts is probably cheating, though. And i'm sure anyone who really knows Ruby can get this sub-100. I didn't spend more than a few minutes on it and i only used the most obvious shortcuts (like replacing variable names with its content).

Originally Posted by
towwdso
sub 277 bytes
So you mean 276 bytes? Or 275 bytes? Or 200 bytes? Or 142 bytes? WTF? "sub" is really the most overused term amongst cubers. It's so annoying...
Bookmarks