Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Alchemy - A word Game
#21
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:
b = b + ...
Reply
#22
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!
Reply
#23
@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.
Reply
#24
(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


Attached Files Image(s)
   
b = b + ...
Reply
#25
I spent the day reworking Alchemy, all my mods are noted in comments under the Title.

New: I saved the successful First Word to Target lists in numbered files above the Alchemy bas and EXE.

The pairs data file is now called "Alchemy Pairs.txt" so you can find under the exe.

So all the dictionary (letter)-Words.txt files are listed under alchemy files, if your directories list files in alpha order.


Attached Files
.zip   Alchemy b+ mod.zip (Size: 692.33 KB / Downloads: 37)
b = b + ...
Reply
#26
Download tested, works for me here is new solution for #23 CUP to PLATE
05-08-2022 23:37:23
CAP
CAPE
PLACE
PLATE
b = b + ...
Reply
#27
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.
b = b + ...
Reply
#28
Well done bplus. I have to admit to using that method myself when "proofing" the word-pairs. Blush
Reply
#29
(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?  Huh
(I've white-listed the QB64 folder)
Reply
#30
(05-09-2022, 03:21 AM)bplus Wrote:
(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!
Reply




Users browsing this thread: 6 Guest(s)