require 'letter_press_is_not_as_good_as_boggle' words = LetterPressIsNotAsGoodAsBoggle do board %w[o y c z i s e m x k z i s v s w e a v o d d f k a] guesses %w[kamikaze mocked disavowed kiddies mocked miscoded wifes coveys amazed admixes] end def score(word, targets) (targets - word.chars.to_a).size end words.sort_by { |word| [-score(word, %w[z]), word.size] } .each { |word| puts word }