1
0
Okay, I recently wrote a Javascript Rubik's Cube scrambler that outputs a 25-move scramble. It's 135 bytes. The Gist is here, but for reference, I have the formatted code:
function(){
for(a=s=y=r=[],m='RLUDFB',x=Math.random;++a<26;y=r,s.push(r+["'",2,''][0|x()*2]))
for(;r==y;r=m[0|x()*5]);
return s.join(' ')
}
Any tips?
EDIT: Code is updated, with @Optimizer's edits.
I am assuming that you need to run this in browser, so ES5 and below only ? – Optimizer – 2015-05-29T22:34:03.540
Some of the answers are likely to be complete rewrites rather than tips for lowering the byte count of your algorithm/implementation. – Sparr – 2015-05-29T22:35:27.793
@Optimizer Yeah, you have to run in a browser console. – Mama Fun Roll – 2015-05-29T22:40:33.750