Module: WordScramble

Defined in:
lib/word_scramble.rb,
lib/word_scramble/version.rb

Overview

Word Scramble

A game played in the Virgin Airlines waiting lounge.

Input is a scrambled string. You try to make a word from those letters.

Examples
"rnmteial" => "terminal"
"realapin" => "airplane"
"liopt" => "pilot"

Usage

descrambler = WordScramble::Descrambler.new("realapin")
descrambler.matching_words  # => ["airplane"]

Defined Under Namespace

Classes: Descrambler, LetterFrequency, ScrambledWord

Constant Summary collapse

DICTIONARY =
File.open(File.expand_path('../dictionary.txt', __FILE__)) do |f|
  dictionary = {}
  f.each_line do |line|
    word = line.strip
    length = word.length
    dictionary[length] ||= []
    dictionary[length].push(word)
  end
  dictionary
end
VERSION =
"0.1.0"