So last night I was playing Text Twist on Yahoo games. The game is basically a word unscrambling game, and to continue on, you have to figure out the 6-letter word. I was doing poorly, and decided that I should write a program that would unscramble the words for me.
Things I needed to write this program:
I found an 80,000 word list, and finally managed to get it in my database. The database part was simple, but the size was killing the system, so it took a while to make it work. My poor little editplus program about keeled over and died when I did a search and replace that replaced 80,000 occurrances, but it persevered.
Next I had to find a way to get all possible permutations of the letters. I found a bunch of very mathmatical papers, but they made my eyes glaze over, so I was happy when I found an example that was explained in slightly simpler terms. (Andy's Permutation Algorithm)
Finally, I brought the word list and the permutation part together and it works! I can play Text Twist forever, and always get the 6-letter word. The downside is that now Text Twist is really boring.
My word unscrambler is here.
Cool...I dont know if anyone who reads this would care, but I am in the middle of a problem that I am having trouble to solve. Using the letters in THERMODYNAMICS, I have to create new words and list as many as possible. All I know about the answer is that there is 3500 words I can make. I really hope this unscrambler helps out. THANKS...
Posted by: Lost In Work at November 27, 2003 09:38 AMit's always better to process the dictionary words
than doing permutation. You can use storing the alphabets in an array and comparing the arrays.
as follows:
// read in dictionary words, one at a time and process
while(!StdIn.isEmpty()) {
String s = StdIn.readString();
// check that s is of right length
if (s.length() > word.length()) continue;
// compute profile of s
for (int i = 0; i < 26; i++)
cnt2[i] = 0;
for (int i = 0; i < s.length(); i++)
++cnt2[s.charAt(i) - 'a'];
// check against input word
boolean match = true;
for (int i = 0; i < 26; i++)
if (cnt1[i] < cnt2[i]) match = false;
if (match) System.out.println(s);
}
}
}
Thanks,
Monster
Actually, that algorithm won't work for what I'm trying to accomplish, because I want all the words that can be made out of the letters in the entered word, rather than just anagrams of the word.
I've revamped it all since I wrote it originally, and now in the database all the words are keyed off of their letters in alphabetical order, so I don't have to permutate the combinations anymore, just look up words by the key.
Posted by: rachel at April 27, 2004 11:32 AMI really like your site but, it wouldn't be good enough for my spelling words! your site only had 15 out of 20 words!
Posted by: RJ at April 29, 2004 04:22 PMto anyone of you! please send me an email about the source code of the game text twist please i need it this week thank you all and god bless
Posted by: micah at March 9, 2005 06:40 AMVery addicting game.
I got 100,000 in a few minutes with the help of a word finder :)
http://marvin.mindhyve.com/wordfinder
check it out!!
can you hep me how to make a tex twist program???plzzzzz..
Posted by: eric at February 8, 2008 10:04 PMIf anyone wants a really fast unscrambler, I created this one with some help from a friend of mine. It uses grep to seach through a text based dictionary for any word that only has the letters in the original scrambled word. The unscrambler is at http://paprika.umw.edu/~nlewis/unscramble.php. There is a link to its source as well.
Posted by: Nicholas at March 7, 2008 06:07 AM[URL=http://gtxcvxss.com]sbbwlvzv[/URL] prheswys tvepwkai http://neqsklka.com dfcsqxci vzucpajt
Posted by: esolitmw at September 3, 2008 02:06 PM