05-08-2022, 03:10 PM (This post was last modified: 05-08-2022, 04:29 PM by bplus.)
It seems to work OK if don't try anything illegal but I tried BAD right after BIG, by sound it knew it was incorrect but left BAD word up on screen. Nope haven't figured out how it handles words off by more than 1 letter, I suppose you have to count wrong words on the way?
BTW use escape key for quit Ascii 27, so you can use Q words. Nope it works as is.
1411 Q words, there were 24,347 lines in the file, takes longer than it has to.
Code: (Select All)
For i = 1 To 26
letter$ = Chr$(i + 64)
filename$ = letter$ + "-Words.txt" ' <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< fix line 207 select dictionary file of first letter of try-word
Open filename$ For Input As #1
Open "temp.txt" For Output As #2
While Not EOF(1)
Input #1, fline$
If _Trim$(fline$) <> "" Then Print #2, fline$
Wend
Close
Kill filename$
Name "temp.txt" As filename$
Next
I used following code to remove all the blank lines in the Letter Files:
Wow, well spotted! (the Q file). I think I left the lines for the whole dictionary intact in the Q file after I removed the words for the other 25 letters. I'll fix that.
The line 207 error was fixed yesterday.
As for identifying more than one addition or removal, I found it easiest to first compare each letter in the New word with the ones in the Previous word, removing them when found, and counting the ones remaining in the Previous word as removed letters, then refreshing the Previous word and reversing the process to find added letters.
I will be using the If _FileExists to check for a file when I work out the best way to do this.
A lot of this is a learning/re-learning experience for me.
Thanks again. You're a legend!
@bplus I just tried to use the snippet you posted to remove empty lines, but got an error "C++ Compilation failed". On checking, I've found I can't produce ANY new program in QB64... even a simple "SCREEN 12 : PRINT "OK" : SLEEP. All my other progs re-compile OK, even when I make minor changes to them. Totally confused. I'm still checking.
(05-09-2022, 01:31 AM)PhilOfPerth Wrote: @bplus I just tried to use the snippet you posted to remove empty lines, but got an error "C++ Compilation failed". On checking, I've found I can't produce ANY new program in QB64... even a simple "SCREEN 12 : PRINT "OK" : SLEEP. All my other progs re-compile OK, even when I make minor changes to them. Totally confused. I'm still checking.
You have to Save the snippet in the folder with the files being stripped of blank line and you have to make sure in the Run Menu of the IDE is set to Save Exe in same folder as Source
05-09-2022, 08:39 PM (This post was last modified: 05-09-2022, 08:42 PM by bplus.)
Finally I made my way from the bedroom to the kitchen:
05-09-2022 16:20:39
ROOMED
ROMEO
CROME - garden fork in UK
CRIME - prevalent in USA
CRINE - Scottish shrink or dried up
CHINE - backbone or cut of meat from there
ETHNIC
KITCHEN
Just made up words and found out they were in dictionary.
(05-08-2022, 03:10 PM)bplus Wrote: It seems to work OK if don't try anything illegal but I tried BAD right after BIG, by sound it knew it was incorrect but left BAD word up on screen. Nope haven't figured out how it handles words off by more than 1 letter, I suppose you have to count wrong words on the way?
BTW use escape key for quit Ascii 27, so you can use Q words. Nope it works as is.
1411 Q words, there were 24,347 lines in the file, takes longer than it has to.
Code: (Select All)
For i = 1 To 26
letter$ = Chr$(i + 64)
filename$ = letter$ + "-Words.txt" ' <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< fix line 207 select dictionary file of first letter of try-word
Open filename$ For Input As #1
Open "temp.txt" For Output As #2
While Not EOF(1)
Input #1, fline$
If _Trim$(fline$) <> "" Then Print #2, fline$
Wend
Close
Kill filename$
Name "temp.txt" As filename$
Next
I used following code to remove all the blank lines in the Letter Files:
Hi @bplus
I've got the computer up and running again, after re-installing Windows.
I'm able to create progs again in QB64, and they compile ok.
But when I place the code above into the editor and try to run it, it says"compilation faied (C++)".
Should I be able to do this?
(I've white-listed the QB64 folder)
(05-09-2022, 01:31 AM)PhilOfPerth Wrote: @bplus I just tried to use the snippet you posted to remove empty lines, but got an error "C++ Compilation failed". On checking, I've found I can't produce ANY new program in QB64... even a simple "SCREEN 12 : PRINT "OK" : SLEEP. All my other progs re-compile OK, even when I make minor changes to them. Totally confused. I'm still checking.
You have to Save the snippet in the folder with the files being stripped of blank line and you have to make sure in the Run Menu of the IDE is set to Save Exe in same folder as Source
The snippet is in the same folder as the A to Z files (and QB64.exe), it is set to compile into the same directory, and the QB64 folder is all white-listed.
I've tried REMing out all but the for and next lines, and it still won't compile! I can write progs now and save them and they compile ok and run.
I need a coffee!