Hi,

I'm currently going through MIT's open courseware course on programming and I'm stuck on this assignment:

http://ocw.mit.edu/NR/rdonlyres/Electrical-Engineering-and-Computer-Science/6-00Fall-2008/BA350EF8-DA45-41D6-AEA2-B8555EE77DBE/0/pset6.pdf

(Problem 3)

Basically you have a hand of letters and need to get the computer to make a word from those letters that scores the most points


I have the dictionary mapping the words to their point value but I don't know how I can make the computer pick the best word from my hand ?


Any Ideas ?

Thanks

So this is basically... similar to Scrabble? So you need two things:

1. Anagram finder to find every possible anagram
2. Simple search of your dictionary to see which anagram results in the most points.

P.S. I'm not a genius on the subject but it seems like you need to generate every possible permutation of your set of letters and for each permutation you generate, check to see if it is in your dictionary, and if so, check to see if it is higher than your current highest word. If so, it becomes the new highest word. I'm suggesting that you look into some open source code to learn about generating the permutations, and what you're looking for is called an anagram.

this also looks potentially useful.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.