Mastermind, Knuth's solution in Ruby.