Hello, does anybody know how I would go about making a word unscrabler?
Like the user inputs "gorf" and the computer spits out all possible combinations like
g
o
r
f
gg
go
gr
gf
og
oo
or
of
rg
ro
rr
rf
fg
fo
fr
ff
ggg
And so on until ffff?
Thanks,
Hello, does anybody know how I would go about making a word unscrabler?
Like the user inputs "gorf" and the computer spits out all possible combinations like
g
o
r
f
gg
go
gr
gf
og
oo
or
of
rg
ro
rr
rf
fg
fo
fr
ff
ggg
And so on until ffff?
Thanks,
Adam
Well I don't know how you think "gg" or many of your other examples is "gorf" unscrambled, but if you want a program that spits out all possible permutations of a word, you could look at the solution to the permutations challenge on Cprogramming.com
http://www.cprogramming.com/challenges/permutesol.html
Example:
Or if it pleases you:Code:> permute dog dgo dog gdo god odg ogd
Code:> permute frog frog frgo forg fogr fgor fgro rfog rfgo rofg rogf rgof rgfo orfg orgf ofrg ofgr ogfr ogrf grof grfo gorf gofr gfor gfro
Last edited by SlyMaelstrom; 12-12-2005 at 10:10 PM.
Sent from my iPadŽ
Actually a permutation generator is a pretty P.i$$ poor way to tackle anagram problems...
For the simple reason a nine letter word would take a long time to solve.
9!
A letter frequency counter is a much better option.
http://cboard.cprogramming.com/showt...lems+factorial
The link to the dictionary file might be dead. Try this one instead...
Again renaming it 'dictionary.txt' and saving it in your current directory where you intend to run your program.
http://java.sun.com/docs/books/tutor...dictionary.txt
Last edited by treenef; 12-13-2005 at 03:04 AM.