 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
nicholas761
Joined: 04 Mar 2008 Posts: 3
|
Posted: Tue Mar 04, 2008 1:56 am Post subject: Need help making an anagram unscrambler |
|
|
I'm pretty good at AutoHotKey and I don't know how to approach this...
I am making a macro to play a word game, where the person enters the letters and then the macro will list the 3, 4, 5, 6, and 7 letter words that the letters make and then type it in the game.
I obviously know how to have the person enter the letters and then to make the macro type them in. I need help with the anagram part.
Thanks,
Nicholas |
|
| Back to top |
|
 |
BoBoĻ Guest
|
Posted: Tue Mar 04, 2008 9:28 am Post subject: |
|
|
| [here] ? |
|
| Back to top |
|
 |
Guest
|
Posted: Tue Mar 04, 2008 7:42 pm Post subject: |
|
|
Try the search function for a topic called scrambled eggs
I made it for texttwist and textexpress both online word games.
Goodluck
leroxy |
|
| Back to top |
|
 |
nicholas761
Joined: 04 Mar 2008 Posts: 3
|
Posted: Wed Mar 05, 2008 12:58 am Post subject: |
|
|
| I've seen Scrambled Eggs, and it doesn't give only actual words though, it just moves the letters around...The other script is hard...Could someone explain it better? EDIT: Actually, I enter scrambled letters in it and it gets no results, but when I enter an actual word, it works.. |
|
| Back to top |
|
 |
leroy Guest
|
Posted: Wed Mar 05, 2008 1:14 am Post subject: |
|
|
Well about the scrambled egg part yes it sends all possible letter configurations.
The only thing you got too put into it is a dictionary.
So compare if the word exist then send it.
If you found something or even a full digital dictionary post it please.
Wish I had found a digital dictionary back when I made scrambled eggs then it wouldn't give me that much false positive's into the game.
It can be done ,but you need a dictionary too see if its a word
leroxy |
|
| Back to top |
|
 |
Guest
|
Posted: Wed Mar 05, 2008 1:40 am Post subject: |
|
|
| try searching for openoffice wordlist |
|
| Back to top |
|
 |
nicholas761
Joined: 04 Mar 2008 Posts: 3
|
Posted: Wed Mar 05, 2008 1:58 am Post subject: |
|
|
I found a dictionary. It should be a good one because it said something about it being the "official Scrabble dictionary"...
http://www.autohotkey.net/~nicholas761/dictionary.ini
Could you or someone else please change the script to add in the "check word" part? I'm sorry, but I can't do the read file functions well. |
|
| Back to top |
|
 |
Nicholas762 Guest
|
Posted: Fri Mar 07, 2008 7:21 pm Post subject: |
|
|
Anyone?
And I have another question - does this do sub-anagrams? Look under "anagram" on Wikipedia to see what I mean. |
|
| Back to top |
|
 |
Peterm353
Joined: 07 Mar 2008 Posts: 2
|
Posted: Fri Mar 07, 2008 11:33 pm Post subject: Anagram program |
|
|
|
|
| Back to top |
|
 |
jaco0646
Joined: 07 Oct 2006 Posts: 557 Location: MN, USA
|
Posted: Sat Mar 08, 2008 10:00 pm Post subject: |
|
|
Here's my take on an anagram solver. It's just a brute force method, so it's really too slow to be useful on anything more than short words (even a 5-letter word took almost 8 minutes). I used the dictionary provided by nicholas761; but cut out the words over 9 letters; which reduced its size by more than half.
| Code: | SetBatchLines, -1
InputBox, word, Anagrams ``Rī Us
, Enter a word to discover its anagrams.,, 250, 120
If ErrorLevel
ExitApp
FileRead, WordList, WordList.txt
StringSplit, word, word
If word0 > 9
{
MsgBox,16,Anagrams ``Rī Us
, The word has too many letters (%word0%). The max allowed is 9.
ExitApp
}
Loop,% word0
{
num .= 1
end .= word0
}
Progress, R%num%-%end%, 0:00, Searching..., Anagrams ``Rī Us
StartTime := A_TickCount
Loop
{
If (A_Index = end)
break
scramble=
num++
T := A_Year
T += (A_TickCount-StartTime)/1000, Seconds
FormatTime, time, %T%, m:ss
Progress, %num%, %time%
StringSplit, num, num
Loop,% num0
{
StringReplace, num, num,% num%A_Index%,% num%A_Index%, UseErrorLevel
If ErrorLevel > 1
break
var := num%A_Index%
If var
scramble .= word%var%
}
If ErrorLevel > 1
continue
Loop, Parse, NotWords, `n `r
If (A_LoopField = scramble)
{
duplicate = 1
break
}
If !(duplicate)
{
If (scramble = word)
duplicate = 1
Else Loop, Parse, anagrams, `n, `r
If (A_LoopField = scramble)
{
duplicate = 1
break
}
}
If !(duplicate)
If scramble in %WordList%
anagrams .= scramble "`n"
Else NotWords .= scramble "`n"
duplicate = 0
}
Progress, Off
MsgBox,64,Anagrams ``Rī Us,% word " -->`n`n" anagrams |
_________________ http://autohotkey.net/~jaco0646/ |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|