Name | Modified | Size | Downloads / Week |
---|---|---|---|
dumbo.rar | 2013-01-30 | 681.9 kB | |
dumbo.hs | 2013-01-30 | 3.7 kB | |
README.txt | 2013-01-29 | 933 Bytes | |
Totals: 3 Items | 686.5 kB | 0 |
Dummy program that takes a string of characters (e.g. str == "asdeqwdrfesatgha") and natural number n (1 <= n <= length str) and finds all words made from characters from str with length n (checks in a dictionary if the current string with length n is a word). Made it to help a friend cheat in a Android app called "Scrabble" or whatever. Written in Haskell, which I'm still learning. To make it more effective I've used a family of trees - one for each letter from the alphabet, a tree represents all words of the dictionary starting with a given letter. After that given a string the tree either "recognizes" it as a word and returns the same word or otherwise returns an empty string. This method is way faster than direct search for a string of the pool (666k strings for n = 6, length str = 12) in the dictionary (~120k entries). Still a very naive method which can be optimized a lot more but I did it just for fun.