In the London Dojo last month, we worked on Word Chains or Word Ladders. I have finally got round to implementing the breadth first algorithm: https://github.com/c4m3lo/word-chains/blob/master/team_1/wordchain_bf.py
It seems to perform reasonably well: $ python wordchain_bf.py ape man Using a dictionary with 585 3-letter words Solution in 5 steps: ['ape', 'apt', 'opt', 'oat', 'mat', 'man'] $ time python wordchain_bf.py flour bread Using a dictionary with 4607 5-letter words Solution in 6 steps: ['flour', 'floor', 'flood', 'blood', 'brood', 'broad', 'bread'] real 0m0.588s user 0m0.320s sys 0m0.090s Using Ubuntu's /usr/share/dict/words $ time python wordchain_bf.py seven eight Using a dictionary with 4608 5-letter words No solution real 0m13.318s user 0m13.020s sys 0m0.110s Using SOWPODS: $ time python wordchain_bf.py -d sowpods seven eight Using a dictionary with 12478 5-letter words Solution in 9 steps: ['seven', 'semen', 'samen', 'sames', 'sanes', 'sines', 'sinhs', 'sighs', 'sight', 'eight'] real 1m10.842s user 1m10.500s sys 0m0.120s See you tomorrow for the next one! Dave On 8 June 2012 14:47, Nicholas H.Tollervey <nt...@ntoll.org> wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > Hi Dave, > > See https://github.com/ntoll/word-chains (the team_1 folder). > > Enjoy your weekend hack! ;-) > > N. > > On 08/06/12 14:44, David Walker wrote: > > Nick, > > > > Did you manage to get the code we wrote last night onto Github? I > > fancy trying to fix my bugs. > > > > Cheers, > > > > Dave > > > > On 31 May 2012 11:04, Nicholas H.Tollervey <nt...@ntoll.org > > <mailto:nt...@ntoll.org>> wrote: > > > > Hi, > > > > Carles has booked two slots for a 10minute talk on, well, let's > > just say it'll be fun to watch and smell his presentation. > > > > One more space left... any takers..? > > > > :-) > > > > N. _______________________________________________ python-uk > > mailing list python-uk@python.org <mailto:python-uk@python.org> > > http://mail.python.org/mailman/listinfo/python-uk > > > > > > > > > > _______________________________________________ python-uk mailing > > list python-uk@python.org > > http://mail.python.org/mailman/listinfo/python-uk > > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.4.11 (GNU/Linux) > Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ > > iQEcBAEBAgAGBQJP0gKFAAoJEP0qBPaYQbb6OQAIAJOZDTAMI87RmS5Xrr2cltqV > zLvAq0NFVzXqm48/6C5UKsqJXA+ib9Qs1c+gy+QkwBvwe4qswC6VbJ3evzKmXV4e > 6iRZh50+ZEpWqidNzrrw6+wRv65CeTXk2L2YOo05klmtW2drylHCAvCWRe8vB/Si > dYZ53mFavcEjxDQbanfG0SZwDOuI81znDVnU5TdSSGqUZiJCiq/t7s2RIkmbw8cc > PSds6EohbS4wJIlizfermG6ZYjvlVykiJqjrKxh1VCExsCmm88C0wF+1YTrc0QOr > i9UrKCJyx/fSq3XnimMUIdflteO5NInSlzxDZM5eHgTLHT8pRV2uMxhTouTXbuc= > =Zz+0 > -----END PGP SIGNATURE----- > _______________________________________________ > python-uk mailing list > python-uk@python.org > http://mail.python.org/mailman/listinfo/python-uk >
_______________________________________________ python-uk mailing list python-uk@python.org http://mail.python.org/mailman/listinfo/python-uk