From: Francois Paul Date: 2005-08-26T23:03:00+09:00 Subject: Re: [QUIZ] Word Chains (#44) does anyone have a working link for the wordlist.txt dictionary that Dave links (broken) to from codekata? Ruby Quiz wrote: >The three rules of Ruby Quiz: > >1. Please do not post any solutions or spoiler discussion for this quiz until >48 hours have passed from the time on this message. > >2. Support Ruby Quiz by submitting ideas as often as you can: > >http://www.rubyquiz.com/ > >3. Enjoy! > >-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= > >Our own Dave Thomas has also posted some Ruby code challenges on his blog in the >past. There are several interesting problems there: > > http://codekata.org/ > >This week's Ruby Quiz is one of my favorite problems posted by Dave. > >Given two words of equal length as command-line arguments, build a chain of >words connecting the first to the second. Each word in the chain must be in the >dictionary and every step along the chain changes exactly one letter from the >previous word. > >Again, your program should accept input as two command-line arguments. Your >program should also allow a -d command-line switch followed by a dictionary file >to use, but feel free to choose a sensible default for your system. The result >should be a word chain starting with the first word and ending with the last >printed to STDOUT, one word per line. Print an error message if a chain cannot >be found. > >Bonus points for finding the shortest chain and/or a small execution time. > >Here's an example: > > $ time ruby -d word_chain.rb duck ruby > Loading dictionary... > Building chain... > duck > ruck > rusk > ruse > rube > ruby > > real 0m27.551s > user 0m27.402s > sys 0m0.113s > > > >