Here's my version. It's a little different from both Kendall's and the original:
a) Like the original, but unlike Kendall's it takes a whole word at a time (you can delete characters until you press enter)
b) Also, it will automatically convert lower case letters to upper case
c) Unlike the original, but like Kendall's, it allows you to supply "non-words" - for example to check which letters are involved
d) Unlike the original, I've tried to select words with unambiguous spellings, though it's possible I've got some "English" (rather than "American") spellings.
I've supplied a dictionary of ~4500 words, drawn from the ~12000 five letter words in sowpods. I've tried to choose the words so that they will be fairly well known (I've removed what I consider "technical", "foreign", and "obscure" words) - though of course my definition and yours may differ! Please feel free to amend the file as you wish.
Best wishes,
D
PS Edited to correct the flaw mentioned below...
...and the other one...
Code: Select all
REM Whirdle - a word game that may seem not terribly unfamiliar to players of Wordle!
DIM words$(4250)
f%=OPENIN("FiveletterWords.txt")
count%=0
WHILE NOT EOF#f%
INPUT#f%,t$
IF LEFT$(t$,1)=CHR$(10) THEN t$=MID$(t$,2)
IF LEN(t$)=5 THEN
words$(count%)=t$
count%+=1
ENDIF
ENDWHILE
CLOSE#f%
done%= FALSE
score%=0
MODE 21
VDU 5
WHILE NOT done%
wordn%=RND(count%)-1
word$=FNUpper(words$(wordn%))
CLS
MOVE 0,1100
PRINT "Enter a five letter word, and then press 'enter'"
PROCDrawGrid
go%=1
correct%=FALSE
WHILE go%<7 AND NOT correct%
guess$=""
REPEAT
t%=GET
IF t% = 8 OR t% = 135 THEN
REM Backspace/delete
IF LEN(guess$)>0 THEN
guess$=LEFT$(guess$)
GCOL 0
RECTANGLE FILL 102+ LEN(guess$)*100,1098 - go% * 100,96,-96
GCOL 15
ENDIF
ENDIF
IF t% > 96 AND t% < 123 THEN t% -= 32 :REM convert lower case to upper case
IF t% > 64 AND t% < 91 AND LEN(guess$) < 6 THEN
REM Add letter to string and display
REM GCOL 15
t$=CHR$(t%)
guess$ = guess$ + t$
MOVE 40 + LEN(guess$)*100,1060 - 100 * go%
PRINT t$
ENDIF
UNTIL t% = 13 AND LEN(guess$) = 5
REM OK, now we need to mark the homework!
t$ = word$
IF word$=guess$ THEN correct% = TRUE
REM First check the correct letters
FOR x% = 1 TO 5
IF MID$(guess$,x%,1) = MID$(word$,x%,1) THEN
REM Right letter, right place!
GCOL 2
RECTANGLE FILL 2+ x%*100,1098 - go% * 100,96,-96
GCOL 15
MOVE 40 + x%*100,1060 - 100 * go%
PRINT MID$(guess$,x%,1)
word$=LEFT$(word$,x%-1)+" "+MID$(word$,x%+1)
ENDIF
NEXT x%
REM Now check for out of place letters
FOR x% = 1 TO 5
t% = INSTR(word$,MID$(guess$,x%,1))
IF t%>0 AND MID$(word$,x%,1) <> " " THEN
REM Right letter, wrong place!
GCOL 7
RECTANGLE FILL 2+ x%*100,1098 - go% * 100,96,-96
GCOL 15
MOVE 40 + x%*100,1060 - 100 * go%
PRINT MID$(guess$,x%,1)
word$=LEFT$(word$,t%-1)+"*"+MID$(word$,t%+1)
ENDIF
NEXT x%
word$=t$
go% += 1
ENDWHILE
MOVE 0,200
IF correct% THEN PRINT "Well done! ";
PRINT "The correct answer was ";word$
PRINT "Press any key to play again, or Q to quit"
q$=GET$
IF q$ = "q" OR q$ = "Q" THEN done% = TRUE
ENDWHILE
END
:
DEFPROCDrawGrid
LOCAL x%,y%
FOR x% = 0 TO 5
LINE 100 + 100 * x%,400, 100 + 100 * x%,1000
LINE 100 ,400 + 100 * x%, 600, 100 * x%+400
NEXT x%
LINE 100 ,1000, 600, 1000
ENDPROC
:
DEFFNUpper(w$)
LOCAL x%,t%,t$
FOR x%=1 TO 5
t%=ASC(MID$(w$,x%,1))
IF t% > 96 AND t% < 123 THEN t% -= 32
t$ += CHR$(t%)
NEXT x%
=t$
You do not have the required permissions to view the files attached to this post.