Jump to content

Best shuffle: Difference between revisions

m
m (→‎{{header|Sidef}}: updated code)
Line 3,410:
var t = s.shuffle
 
for i (^s.range.each) { |i|
for j (^s.range.each) { |j|
if (i!=j && t[i]!=s[j] && t[j]!=s[i]) {
t[i, j] = t[j, i];
break;
}
}
}
 
var(t.join, words ~Z== t.join; -> count(true))
(word, orig ^ word -> count("\0"));
}
 
for word (<abracadabra seesaw elk grrrrrr up a>.each) { |word|
var (sword, score) = best_shuffle(word)
"%-12s %12s: %d\n".printf(word, sword, score)
2,747

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.