Skip to content

Instantly share code, notes, and snippets.

@ctcherry
Created May 10, 2011 20:03
Show Gist options
  • Save ctcherry/965261 to your computer and use it in GitHub Desktop.
Save ctcherry/965261 to your computer and use it in GitHub Desktop.
scrabble word finder
require 'rubygems'
require 'raspell'
speller = Aspell.new('en_US')
input = "BLPONEA"
options = input.split('').permutation(5).collect { |*args| args[0].join('') }
puts "Given '#{input}', there are #{options.size} possible combinations of letters."
puts "Possible words:"
options.select {|w| speller.check(w) }.each do |w|
puts w
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment