Coding fun, that is. Why, what were you thinking?
Amy, for reasons best known to herself, posited the following problem on Facebook:
Challenge: See how many words you can make using the letters from "entertainment", but *only* in the order they originally appear, i.e. tram is fine but meat is not.
We'll ignore the pro-public-transport-and-vegetarianism agenda clearly supported by this brain-washing exercise, and focus on solving the problem.
I used the word list available here: http://www.puzzlers.org/pub/wordlists/enable1.txt to solve the problem. A more efficient, but slightly less comprehensive, solution would have used the Official Scrabble Wordlist, which is limited to words of eight or fewer letters, and is available here: http://www.puzzlers.org/pub/wordlists/ospd.txt. Thankfully, "aardwolf", my new favourite word, is included on both.
The Python script I used to solve the problem can be found here: http://pastebin.com/1QvTwvCq. Anyone on a Mac or a UNIX/Linux computer should be able to simply run the script by double-clicking it - anyone on Windows will probably have to download and install the excellent, wonderful, graceful, beautiful, utterly splendid language known as Python (from the download link off of here) to run it. You won't regret it. Coding has been one of the more life-changing skills I've ever learnt (not that I would claim to be very good!), and while every nerd has their favourite language, Python is generally acknowledged as being one of the easiest to learn on (citation: here)
YAY VEGETARIANISM.
ReplyDeleteWhy is the Scrabble word list limited to <9 letters? Surely if you use pre-existing letters you can make longer words.