(Scrabble) Standalone Anagram Solver N/4-15___v1.05

Post gaming related scripts
littlegandhi1199
Posts: 43
Joined: 29 Aug 2016, 23:58

(Scrabble) Standalone Anagram Solver N/4-15___v1.05

10 Jul 2017, 15:54

At first, all possible combinations of an 11 letter word would give you 39.9 million words and that many queries into the dictionary.

That is until Helgef realized you can simply sort all the letters in your word alphabetically and then all entries under that same unique string in your dictionary are anagrams!
tea becomes eat
ate becomes eat
eat stays eat
you type in "tae" and it becomes eat and it will dump all anagrams with ONE QUERY!

Now, I had already built my script to generate permutations using again 11 letters taken at simple sizes of 4(3 or less is too boring ;) 5 6 up to 13.
His method wouldn't work or save you any time for any other length because you need all 11 letters accounted for with every other letter at least once in your 4 letter word queries.
To guarantee that, I thought I'd need all 87 billion queries for 13 letter words from a 14 letter input.
I like to mash my keyboard too to find words I'd be surprised were waiting in the soup of characters and when I put 15 letters in we're already talking 653 billion.

I examined the permutation outputs from "abcdef" and found that it started in regular order and ended in exactly reverse order which looks the same when we query the dictionary.
This is when I realized I needed to find the pattern that had to stop (I imagined) halfway through the queries.
A hour later I return home from a walk which I set out intentionally disregarding 1 piece of information I realized was more important then anything I had just considered. lol!

*********************************************
So the pattern I discovered...
Spoiler


Script
*********************************************
http://wordlist.aspell.net/12dicts/
The 12dicts lists are oriented towards common words. If you're looking for myriads of archaic, scientific or computer jargon words, you should look elsewhere.

I combine all the American dictionaries from their website into "words.txt" which should be located in %A_ScriptDir%

v1.01 - Cleaned up code. Bugs reported and will be addressed in time
v1.02 - Made perfect wasteless permutation query loops (duplicates are never created and don't have to be queried) now 653bil=105
v1.03 - Culled some unnecessary code from script and combined my two scripts into one
v1.04 - Saved 1100ms from every solve and placed it at beginning of script load instead
v1.05 - Cleaned up presentation of anagrams

Script has a built-in definition button will work on text in the input field without interrupting any running anagram solves
v1.05

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus

Last edited by littlegandhi1199 on 11 Jul 2017, 17:56, edited 20 times in total.
Helgef
Posts: 2235
Joined: 17 Jul 2016, 01:02
Contact:

Re: (Scrabble) Anagram Solver N/4-15

10 Jul 2017, 16:47

Interesting post. Your script looks nice but sometimes anagrams disappear from the edit field, and sometimes the result from one query seems to be mixed with an earlier one. Searching for soup, also listed soap at one point, I had searched for something with an a before I think. Using code tags would be nice.

Thanks for sharing.

Cheers.
littlegandhi1199
Posts: 43
Joined: 29 Aug 2016, 23:58

Re: (Scrabble) Anagram Solver N/4-15

10 Jul 2017, 17:17

Helgef wrote:Interesting post. Your script looks nice but sometimes anagrams disappear from the edit field, and sometimes the result from one query seems to be mixed with an earlier one. Searching for soup, also listed soap at one point, I had searched for something with an a before I think. Using code tags would be nice.

Thanks for sharing.

Cheers.


Yeah I just spent a day and a half figuring out how to make it only generate holey unique permutations and nothing else...
It has to do with the buttons telling the main loop to return to the function to restart a new search though I'm sure.
I know it works at-least once per boot.
littlegandhi1199
Posts: 43
Joined: 29 Aug 2016, 23:58

Re: (Scrabble) Anagram Solver N/4-15

10 Jul 2017, 22:51

littlegandhi1199 wrote:
Helgef wrote:Interesting post. Your script looks nice but sometimes anagrams disappear from the edit field, and sometimes the result from one query seems to be mixed with an earlier one. Searching for soup, also listed soap at one point, I had searched for something with an a before I think. Using code tags would be nice.

Thanks for sharing.

Cheers.


Yeah I just spent a day and a half figuring out how to make it only generate holey unique permutations and nothing else...
It has to do with the buttons telling the main loop to return to the function to restart a new search though I'm sure.
I know it works at-least once per boot.


Wait I remember why I left that alone. I put a msgbox on everytime you hit the ok button and it doesn't always register that input. Are you sure it's really mixed two together?
wolf_II
Posts: 1579
Joined: 08 Feb 2015, 20:55

Re: (Scrabble) Anagram Solver N/4-15___v1.01

11 Jul 2017, 00:30

I have tried your script version 1.01. BTW, thanks for sharing :)
I copied len#.txt files from zip.zip. (your earlier version containing an exe file)

I entered "countdown" - all good.
Next I entered "letters" - and I get "enters" as a possible 6-letters solution. All the 6-letters solutions are:

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus



Keep up the good work! Your script is very fast and uses little memory, impressive!

Edit: That might be the same problem reported again, sorry. But I post anyway to get notifications of new posts here.
littlegandhi1199
Posts: 43
Joined: 29 Aug 2016, 23:58

Re: (Scrabble) Anagram Solver N/4-15___v1.01

11 Jul 2017, 00:59

wolf_II wrote:I have tried your script version 1.01. BTW, thanks for sharing :)
I copied len#.txt files from zip.zip. (your earlier version containing an exe file)

I entered "countdown" - all good.
Next I entered "letters" - and I get "enters" as a possible 6-letters solution. All the 6-letters solutions are:

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus



Keep up the good work! Your script is very fast and uses little memory, impressive!

Edit: That might be the same problem reported again, sorry. But I post anyway to get notifications of new posts here.


Thank you!
Truly, 653billion is down to 105 now and not one more. I really hit the jackpot when I implemented the new scheme because there are no alphabetical repeats now and it doesn't have to check any previous loops (which would put the number of queries back up to 653 billion). I'll bet the memory has to do with that but also just because I split mine up into 15 parts too ;)

Return to “Gaming”

Who is online

Users browsing this forum: No registered users and 6 guests