This wins the internets: combining geek (and I mean, really geek) humor and Led Zeppelin.
*** Black Dog achieved in 36 ZepMarks ***
Naturally, someone else ported it to Python. And, because I’m just like that, I ported it to Ruby:
#!/usr/bin/env ruby
words = ['hey', 'mama', 'said', 'the', 'way', 'you',
'move', 'gonna', 'make', 'sweat', 'groove']
success = [ 0, 0, 1, 2, 3, 4, 5, 6, 7,
8, 5, 9, 7, 8, 5, 10]
iterations = 0
matches = 0
matched = Array.new
while matches < 16
iterations += 1
print "[#{iterations}] "
0.upto(15) do |i|
if matched[i]
print words[success[i]], ' '
else
r = rand(11)
print words[r], ' '
if r == success[i]
matches += 1
matched[i] = true
end
end
end
print "\n"
end
puts "*** Black Dog achieved in #{iterations} ZepMarks ***"
(Oh, c’mon, it was only 604 bytes — don’t whine about it needing an LJ cut!)