|
Post by Carl Gundel on Jan 5, 2022 12:29:00 GMT -5
|
|
|
Post by Chris Iverson on Jan 7, 2022 2:35:47 GMT -5
Sounds like fun, I'll have to give it a try
|
|
|
Post by tsh73 on Jan 9, 2022 12:30:46 GMT -5
|
|
|
Post by tsh73 on Jan 9, 2022 16:27:38 GMT -5
Minimal console program Dictionary from this project (5 letter words - unixdict.txt) libertybasiccom.proboards.com/thread/1828/new-word-puzzle-gameIt really should penalize for "not in the dictionary" words. But original is not doing it. (updated the code a bit for better output) Gameplay: Secret word is generated. Enter 5-letter guess (enter 'give up' to give up and see the word)
?asdf Word not in dictionary ?hello hello h E L L o ?otele Word not in dictionary ?lower lower L o w E r ?basta Word not in dictionary ?bacta Word not in dictionary ?abacus Word not in dictionary ?bulky bulky [B] u L [K] y ?burke burke [B] u r [K][E]?broke broke [B] r o [K][E]?bloke bloke [B][L] o [K][E]?blake blake [B][L][A][K][E] You've got it!
code: 'wordle concept 'console mode 'wO[R]ld 'big is present, [ ] is in the right place dict$="5 letter words - unixdict.txt" 'dict$="5 letter words - Collins Scrabble Words.txt"
k=0 open dict$ for input as #1 while not (eof(#1)) input #1, a$ if trim$( a$)="" or val(a$)<>0 then exit while k = k+1 wend close #1
N=k dim dict$(N)
k=0 open dict$ for input as #1 for k = 1 to N input #1, a$ dict$(k)=lower$(a$) next close #1
print dict$ print k ;" words read" print " ";upper$(dict$(1)) ;" to "; upper$(dict$(N))
secret$=dict$(int(rnd(0)*N+1)) 'print secret$ Print "Secret word is generated. Enter 5-letter guess" Print "(enter 'give up' to give up and see the word)"
[mainLoop] 'guess$=dict$(int(rnd(0)*N+1)) 'print guess$
check$="" for i = 1 to 5 c$=mid$(guess$,i,1) if mid$(guess$,i,1)=mid$(secret$,i,1) then check$=check$+"+" else if instr(secret$,c$) then check$=check$+"." else check$=check$+" " end if end if 'check$=check$+mid$(" .+", int(rnd(0)*3+1),1) next 'print check$
g=0 for i = 1 to 5 c$=mid$(guess$,i,1) ch$=mid$(check$,i,1) select case ch$ case " ": ltr$=" "+c$+" " case ".": ltr$=" "+upper$(c$)+" " case "+": ltr$="["+upper$(c$)+"]":g=g+1 end select print ltr$; next print if g = 5 then print:print "You've got it!" input "press Enter"; dummy$ end end if 'print
'input "press Enter"; dummy$ [newGuess] input ">>";guess$ guess$=lower$(guess$) if trim$(guess$)="give up" then print "So you gave up." print "Secret word was: ";upper$(secret$) input "press Enter"; dummy$ end end if found = 0 for i = 1 to N if guess$ = dict$(i) then found = 1: exit for next if not(found) then print "Word not in dictionary": goto [newGuess] goto [mainLoop]
|
|
|
Post by tsh73 on Jan 10, 2022 16:43:03 GMT -5
Got it to more playable form (uses ssecond dictionary with word defintions to show secret word meaning) So finally you can just give up 5 letter words - Collins Scrabble Words.txt 12972 words read AALII to ZYMIC Secret word is generated. Enter 5-letter guess (enter 'give up' to give up and see the word)
>>give up So you gave up. Secret word was: MONDE M 9014692 MONDE (French) the world; a globe as an ensign of royalty [n -S] press Enter
or persevere and play (and even cheat. If you enter partial word, it will show first five matches) 5 letter words - Collins Scrabble Words.txt 12972 words read AALII to ZYMIC Secret word is generated. Enter 5-letter guess (enter 'give up' to give up and see the word)
>>tatar t A t [A] r >>hello h e l l o >>sorry S o r r y >>stars S t A r [S] >>manas m A [N][A][S] >>..nas Searching... annas arnas bunas donas etnas (...) >>donas d o [N][A][S] >>arnas [A] r [N][A][S] >>annas [A][N][N][A][S]
You've got it! A 0 ANNAS ANNA, (Hindi) a former coin of India [n] press Enter
It may be not very sportsmanlike, but at least I could win Will post code if anyone interested.
|
|
|
Post by David Drake on Jan 18, 2022 7:48:01 GMT -5
|
|
|
Post by colinmcm on Jan 18, 2022 11:15:00 GMT -5
Good Job David.
Being lazy, impatient and somewhat dishonest (not at all like Boris then), I have added a cheat button to your code ( for personal comsumption only of course).
|
|