Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Head breaker
Message
From
03/07/2019 09:20:45
 
 
To
02/07/2019 22:05:53
General information
Forum:
C#
Category:
Coding, syntax and commands
Title:
Miscellaneous
Thread ID:
01669346
Message ID:
01669363
Views:
44
>>>>string[] letters = new string[] { "g", "a", "u", "n", "t", "l", "e", "t' };
>>>Each letter can only be used once?
>>You can use a letter more than once.
>
>So you have a string containing eight letters "gauntlet". Think of it like a base-8 number.
>
>Each digit in the base-8 number can be 0..7, and you extract the index for each position
>from each one.
>
>You can change the base where needed if you have repeated letters in your pool, such
>as "lovingly," which has two letter Ls. It will be faster, but you can also leave it as is.
>
>You have a maximum number of values (~16M per 8-letters) to try (in VFP code):
>
>
CREATE CURSOR c_words (cWord c(8))
>INDEX ON cWord TAG main
>
>CLEAR
>lcArray = "GAUNTLET"
>FOR lnI = 1 to LEN(lcArray)**LEN(lcArray)
>    lcString = SPACE(0)
>    lnIndex = lnI
>    FOR lnJ = 1 to LEN(lcArray)
>        lcString = SUBSTR(lcArray, 1 + (lnIndex % LEN(lcArray)), 1) + lcString
>        lnIndex = lnIndex / LEN(lcArray)
>    NEXT
>    * Try this word
>*    ? lcString
>    INSERT INTO c_words (cWord) values(lcString)
>NEXT
>
>* Show list of words
>BROWSE LAST NOWAIT
>
>* Show any duplicates
>SELECT cWord, SUM(0001) as nCount FROM c_words GROUP BY 1 INTO CURSOR c_dups HAVING nCount != 1
>BROWSE LAST NOWAIT
Thank you, Rick
I'll try it
Anyone who does not go overboard- deserves to.
Malcolm Forbes, Sr.
Previous
Reply
Map
View

Click here to load this message in the networking platform