Sigh, I’ve had this happen three times now, when I install a bunch of applications and press the HOME button to get back, the iPhone comes up with a spinning wheel and won’t stop. When I turn it on, the apple logo comes up and the spinning wheel is under it. “mazbarz”:http://forums.macrumors.com/showthread.php?t=439928 had exctly the same problem. Also you can’t turn it off when you press the Home button and the off button simultaneiously and can’t sync it with itunes. Arrgh!
Calvin wants to solve anagrams. There are lots of great programs out there, but not much source. “Gtoal.com”:http://www.gtoal.com/wordgames/anagrams.html has a good list of source code that is out there, but its hard to find a simple program.
“Gtanag.mai”:http://www.gtoal.com/wordgames/anagrams/gtanag.mai is perhaps the simplest program that is a C program. I’m sure you could use it in any language. What it does is pretty brute force. It takes any dictionary like say a Google search for “unix dictionary list”:google which gets you to “words.txt”:http://linkage.rockefeller.edu/chaynes/words.txt that has a 25,000 word dictionary or the Unix V7 “/usr/dict/words”:http://unix-tree.huihoo.org/V7/usr/dict/words.html and finds all anagrams by first making each entry canonical that is, it takes all the letters and alpha sorts them, so “rich” becomes “chir” and “calvin” becomes “acilnv” and then it can compare them by sorting all the words. If “acilnv” matches, then you have all the words that are anagrams. That is, use the same letters. Quite clever really.
Then there is one that is quite elegant using primes. Basically instead of the canonical form being the sorted order, it assigns a prime number to each letter. Then when you multiply, that number will be unique since it is a product of primes, if the numbers are the same then the word has to be the same. Wow, people like “falbdablet”:http://www.gtoal.com/wordgames/anagrams/flabdablet/anagram.c are sure smart!
So the usage if you like Unix (or Mac OS X which is the same is):
bq. canonize < dictionary | sort | gather The first command, takes an entire text file and turns into the canonical form that looks like "rich=chir" and then sort sorts the canonical alphabetically. Then gather just finds all the identical words. You could also use fgrep to find for instance all the canonical matches. We worked on a new program "search.c" that opens a dictionary that is canonical and sorted and looks for all anagrams. The Unix V7 English list is 24,000 words, but to find some really great word lists, "net-comber.com":http://www.net-comber.com/wordurls.html has a good word list. The main problem is that we really just want an uncluttered list. So "outpost9.com":http://www.outpost9.com/files/WordLists.html has a dictionary and also things that include proper names and abbreviations. The "crosswordman.com":http://www.crosswordman.com/wordlist.html is what is allowed by Scrabble or simple "zip":http://personal.riverusers.com/~thegrendel/ format. The only small problem is that this is a DOS file format, so you need a small tool like "tofrodos":http://www.thefreecountry.com/tofrodos/ to get rid of the CRLF that is in DOS files vs. just the CR that is Unix files.
Found lots of anagram exercises on the web from Stanford and Duke in particular, but found one that is a simple game that is pretty easy to understand:
* “Devdaily”:http://www.devdaily.com/java/jwarehouse/netbeans-src/usersguide/j2seexamples/anagrams/src/com/toy/. This one is a little complicated, but basically it shows you a scrambled word and you have to figure out how to unscramble and turn it into a real word.
There are also lots of completed programs on the web and even whole sites devoted to it. That’s because anagrams are essentially what Scrabble players need. Take a jumble of letters and turn them into potential words and you can just google:”Anagram” to see literally dozens of games.
* “Wordsmith.org”:http://wordsmith.org/anagram/advanced.html. There is a whole site devoted to anagrams and a more advanced program that takes an entire phrase and converts it.
* “Andy’s Anagram Solver”:http://www.ssynth.co.uk/~gay/anagram.html Has a really big 132,000 word dictionary. See how many ways there are to scramble Lakeside! into French.
* “Brendan’s Anagram Generator”:http://www.mbhs.edu/~bconnell/cgi-bin/anagram.cgi. This one tries to take a word and turn it into English. It uses Evan’s program.