You need to download a word list to your computer to use. See program for a site to download the list I use.
Code: Select all
;Program to help playing Wordle, I usually play without it and for curiousity see what other answers
;might have worked. --J. Wyatt, Highlands Ranch, Colorado Jan 30, 2022
;******************************************
;You must download a list of words before using program
;I found a list at http://www-personal.umich.edu/~jlawler/wordlist.html
;download this or whatever list you find and store in Readfile$ location
;******************************************
;Note option 3 is useful to search for good guess words but not play Wordle.
;For example, to find all five letter words containing e,a,u make guessword$(1)="eau??) and first line of data section 33300
;for all words containing e,a, and u in 3 position use 33100
;Version 1.0
#LengthofWords=5
Dim wordtext$(1000000)
Dim FoundText$(1000000)
Dim Guessword$(7)
Dim GuessResult$(6)
Dim NumWords(10)
Dim TypeOfHit.a(6,#LengthofWords)
ReadFile$="C:\Users\Public\Documents\wordlist.txt" ;change if you want to store list somewhere else
;ReadFile$="C:\Users\Public\Documents\words_alpha.txt" ;found this longer list on Github
StoreFile$="C:\Users\Public\Documents\wordfound.txt"
If ReadFile(4,ReadFile$)
WordCount=0
While Eof(4) = 0
t$=ReadString(4)
If Mid(t$,1,1)<>" "
WordCount=WordCount+1
wordtext$(WordCount)=t$
EndIf
Wend
CloseFile(4)
Else
MessageRequester("", "Couldn't read word file", #PB_MessageRequester_Ok)
EndIf
OpenConsole()
PrintN("Number of Words in database = "+Str(WordCount))
time=ElapsedMilliseconds()
;change guesswords$() and guessresults$() to use
; ? in a position means ignore this letter, useful for testing good guess words
Guessword$(1)="caret" ;Example for Jan 30, 2022 where answer was "light"
Guessword$(2)="solid" ;Program shows this was only possible answer
Guessword$(3)="quilt" ;Set Guessword(3) to "" to see possible answers after first two guesses
Guessword$(4)=""
Guessword$(5)=""
Guessword$(6)=""
;0 no hit in word, 1 hit at position, 2 hit somewhere else, 3 hit anywhere (for testing guesses)
GuessResult$(1)="00001"
GuessResult$(2)="00220"
GuessResult$(3)="00221"
GuessResult$(4)="00001"
GuessResult$(5)="00001"
GuessResult$(6)="00001"
If Len(Guessword$(1))<>#LengthofWords
MessageRequester("", "Wrong length first guess word", #PB_MessageRequester_Ok)
End
EndIf
For Guessword=1 To 6 ;convert GuessResult data to TypeOfHit diget
If Len(Guessword$(Guessword))<>#LengthofWords
Break
Else
WordsToGuess=Guessword
For Position=1 To #LengthofWords
TypeOfHit(Guessword,Position)=Val(Mid(GuessResult$(Guessword),Position,1))
Next
EndIf
Next
For WordtoCheck=1 To WordCount
found=1
text$=wordtext$(WordtoCheck)
If Len(text$)=#LengthofWords
Nwords=Nwords+1
For Guessword=1 To WordsToGuess
For Position=1 To #LengthofWords
letter$=Mid(Guessword$(Guessword),Position,1)
If letter$="?"
Continue
EndIf
Select TypeOfHit(Guessword,Position)
Case 0 ;letter not in word
If FindString(text$,letter$)<>0
found=0
Break
EndIf
Case 1 ;letter in position
If Mid(text$,Position,1)<>letter$
found=0
Break
EndIf
Case 2 ;letter in word, but not in position
If CountString(text$,letter$)=0 Or Mid(text$,Position,1)=letter$
found=0
Break
EndIf
Case 3 ;letter in word
If CountString(text$,letter$)=0
found=0
Break
EndIf
EndSelect
Next
If found=0
Break
Else
NumWords(Guessword)=NumWords(Guessword)+1
EndIf
Next
If found=1
FoundCount=FoundCount+1
FoundText$(FoundCount)=text$
EndIf
EndIf
Next
PrintN("Number of "+#LengthofWords+" letter words = "+Str(Nwords))
PrintN("")
For Guessword=1 To WordsToGuess
PrintN(RSet(Str(NumWords(Guessword)),4)+" Words for guess "+Str(Guessword))
Next
PrintN("")
If FoundCount>0
For i=1 To FoundCount
LineCount+1
If LineCount=10
LineCount=0
PrintN(FoundText$(i))
Else
Print(FoundText$(i)+" ")
EndIf
Next
If LineCount<>0
PrintN("")
EndIf
Else
PrintN("No Words Found")
EndIf
PrintN("")
PrintN("Time to analyze = "+Str(ElapsedMilliseconds()-time)+" msec")
Print("Save Results? y/n" )
If LCase(Input())="y"
OpenFile(99,StoreFile$)
For i=1 To FoundCount
WriteStringN(99,Foundtext$(i))
Next
CloseFile(99)
EndIf
End