it seems to me, with computers these days, this should finish
instantly, not take like 20 seconds.
also, please help me make my ruby more ruby-like. i’m new to ruby,
not that i know any other language.
##these are here from when i was first testing
secret_word = “spine”
rack = “spine”
secret_word = secret_word.split(//)
rack = rack.split(//)
test_rack = rack.to_s
##are there enough of the right letters in the rack to spell the word
from the dictionary?
##i think i’m going to use funny spanish names for my methods instead
of descriptive names.
def rodolfo(secret_word, rack)
secret_word.each do |x|
rack = rack.to_s
if rack.include? x
rack = rack.sub(x, ‘’)
##p rack, x
##puts x, ’ rack don’t work’
puts “reading dictionary”
dict = IO.readlines(’/usr/share/dict/words’)
puts “enter rack”
rack = gets.chomp.split(//)
dict.each do |secret_word| if rodolfo(secret_word.chomp.split(//), rack) puts secret_word.to_s end end