class String
  def score
    total = 0
    # ascii 'a' is 97, 97-96 = 1
    self.strip.downcase.each_byte{|c| total += (c - 96)}
    total
  end
end

words = []
File.open("/usr/share/dict/words", "r") do |file|
  file.each_line {|line| words << line.strip}
end

ninetynine = words.find_all {|word| word.score == 99}   


  1. johnryanpowell reblogged this from phoenyxblog and added:
    I always love reading your code. I had thought about doing something similar. But it would have been 500 lines of code....
  2. phoenyxblog posted this
To Tumblr, Love PixelUnion