Skip to content

Instantly share code, notes, and snippets.

@tjboudreaux
Created January 4, 2010 14:58
Show Gist options
  • Save tjboudreaux/268557 to your computer and use it in GitHub Desktop.
Save tjboudreaux/268557 to your computer and use it in GitHub Desktop.
def self.find_scrabble_words ( letters )
words = Array.new
(1..letters.size).each do |i|
letters.permutation(i).to_a.each{
|word| words.push(word.join(""))
}
end
return self.find(:all,
:conditions => ["word in (?)", words.compact ],
:order => "score DESC")
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment