# Torbert, 8.22.2007 puts puts "imstudent@workstation ~/AIFolder $ ruby ladder_shell.rb" $words = File.read("dictionary.txt").chomp.split puts while true print "What word to start with? " current = gets.chomp break if $words.include? current end ladder = Array.new ladder << current for k in 1..5 do puts puts "Current Ladder: #{ladder.inspect}" print "Next word? " current = gets.chomp ladder << current end puts puts "Ladder:" for k in 0..5 do puts "#{k+1}. #{ladder[k]}" end puts outfile = File.open("puzzle.txt", "w") outfile.puts ladder[0] outfile.puts ladder[-1] outfile.close