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


(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 ?


7 Years
Discussion Span
Last Post by BestJewSinceJC

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.

Edited by BestJewSinceJC: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.