_Title "Wordle 4" ' b+ 2022-01-12 as Steve suggested add option to choose how many letters, how many guesses
' b+ 2022-01-09 Wordle 2: this version you have to select words from word list for your guess
'2022-01-10 working but selecting words from wordlist is really slow, need to allow letters to jump up and down the list faster!
' Today we will select word from opened text editor
' 1) copy word to clipboard
' 2) signal this program you've got the new word loaded in clipboard
' Get rid of the ' words in "5 Letter Words.txt" file, too unexpected. So rewrite the file builder from unixdict.txt OK 9 words removed.
' 2022-01-10 Wordle 3: allow repeated letters (make it even harder! to play and code?)
' Revise "Make 5 Letter Words W3.bas" code to rebuild "5 Letter Words W3.txt" with words with repeating letters.
' 2022-01-12 Worde 4: prep word files by running, Make N Letter Word files.bas, (posted at forum already.)
' fix some feedback Locates rfor maximum guesses and letters
' All the variables use here
Dim As Long f
, NLetters
, NGuesses
, topWord
, printRow
, nGuess
, hits
, letter
, p
' ReDim colorCode(1 To NLetters)
Dim wordFile$
, answer$
, guess$
, k$
, blank$
f
= _LoadFont("arial.ttf", 24, "MONOSPACE") ' a nice font for displaying Game letters with colorScreen _NewImage(600, 400, 32) ' leave room for Editor window next to this QB64 app Color _RGB32(200, 200, 200), _RGB32(0, 0, 0) ' not too bright white on black for normal print ' 123456789012345678901234567890123456789012345678901234567890123456789012345
Print " The Skinny on Wordle:" Print " In Standard Wordle Game, you get 6 tries to guess a 5 letter word. " Print " A letter color coded yellow is right letter wrong place." Print " A letter color coded green is right letter right place." Print " ...zzz means to press a key to continue." Print " Press <a> to run an advanced level Wordle Game," Print " any other to play Standard Wordle Game." If k$
= "a" Then 'advanced level lAgain:
Input "Please enter the number of letters (3-12) of words to play "; NLetters
gAgain:
Input "Please enter the number of guesses (2-10) to allow yourself "; NGuesses
_Title "Wordle 4 Advanced Options:" + Str$(NLetters
) + " Letter Words with" + Str$(NGuesses
) + " guesses allowed." NLetters = 5: NGuesses = 6
wordFile$
= _Trim$(Str$(NLetters
)) + "_Letter_Words.txt"Dim dict
(1 To 10000) As String ' oversized array to load word list Open wordFile$
For Input As #1 ' W3 version allows repeated letters, allot of 5 letter 1st names in here topWord = topWord + 1
Locate 24, 6:
Print "You have to click the QB64 app to get focus back into the app.";
answer$
= dict
(Int(Rnd * topWord
) + 1) ' pick new word to guess printRow = 0 ' reset for round
For nGuess
= 1 To NGuesses
' allowed 6 guesses (in Standard Game) hits = 0 ' how many letters are dead right? reset
printRow = printRow + 1 ' track left print line for inputs display mostly
' here we are to select a word from word list in the Editor we opened and copy it to clipboard
Locate 23, 3:
Print "Select a word from Editor and copy to clipboard, press enter when done." blank$ = answer$ ' we use blank to remove letters as we assign colors
For letter
= 1 To NLetters
hits = hits + 1
Mid$(blank$
, letter
, 1) = " " ' remove green letters taken by direct hits colorCode(letter) = 3
For letter
= 1 To NLetters
If colorCode
(letter
) <> 3 Then colorCode(letter) = 2
Mid$(blank$
, p
, 1) = " " ' remove so can't color again For letter
= 1 To NLetters
' now to display our colorful feedback about the guess Locate nGuess
+ 1, letter
+ 13 Locate 16, 2:
Print "The word was "; answer$;
" ...zzz" skip: