|
Post by bplus on Jul 6, 2024 8:40:59 GMT
Is there one game that particularly inspired you to think about trying QB64?
I just did a quick look at A Virus Named Tom, interesting description 2D puzzles are fav of mine.
|
|
|
Post by bplus on Jul 6, 2024 10:30:00 GMT
OK thanks, I will check that out.
|
|
|
Post by bplus on Jul 6, 2024 15:05:56 GMT
I have been thinking about this and something said at JB forum about challenging novices.
I had this idea to challenge newbies by asking them to make up a horse race, or any race between 3 to 10 things. No right answer jst you must recognize it as a race and to bet on the number of one of the things.
Now for you and the Hack idea, rig the horse race to always favor the number you bet on.
Just an idea... I do have some horse race code but it is best the novice comes up with their own.
Am I on the same track (ha excuse the pun) as you @anthonyrbrown ?
|
|
|
Post by bplus on Jul 8, 2024 20:55:42 GMT
Fuzzy Rita, I googled it and its a drink ![:)](//storage.proboards.com/forum/images/smiley/smiley.png) I wonder what the Basic program was. Oh it looks like guess the animal guessing game that you can build as it learns, I have nice version of that somewhere. On-line thing just sat there with S in top right corner, have no idea what it expected??? BTW Hacker way too involved a game for me.
|
|
|
Post by bplus on Jul 8, 2024 21:09:35 GMT
I don't use a phone, read! only if I have to ![:)](//storage.proboards.com/forum/images/smiley/smiley.png)
|
|
|
Post by bplus on Jul 8, 2024 22:06:20 GMT
Of course load the tape. Does your computer have a Scroll Lock?
|
|
|
Post by bplus on Jul 9, 2024 15:59:20 GMT
|
|
|
Post by bplus on Jul 9, 2024 19:17:45 GMT
LOL now that you mention it, I don't see a connection either :-P
I saw something this morning but it's evaporated with the dew.
|
|
|
Post by bplus on Jul 9, 2024 22:26:14 GMT
I am pretty impressed with this. You get a learning machine with so little code!
_Title "Guess Animal - QB64 Conversion of Morristown Version" 'watching LOC, see code notes at bottom ReDim A$(200) L$ = Chr$(10) ' L is for line or next line Print L$ + Spc(35) + "Guess Animal" + L$ + L$ + Spc(11) + "Originally from: CREATIVE COMPUTING MORRISTOWN, NEW JERSEY" + L$ + L$ + L$ Print " Think of an animal and the computer will try and guess it." + L$ If _FileExists("ANIMAL.DAT") Then Open "ANIMAL.DAT" For Input As #3 For I = 0 To 200 Input #3, A$(I) Next Close #3 Else For I = 0 To 3 Read A$(I) Next I End If N = Val(A$(0)) Do Do A$ = LCase$(npt$(L$ + " Are you thinking of an animal (y/n/list)")) If A$ = "list" Then Print L$ + " Animals I already know are:" ' listing computers aimals For I = 1 To 200 If Left$(A$(I), 2) = "\A" Then Print " " + Mid$(A$(I), 3), Next I Print L$ + L$ End If Loop Until Left$(A$, 1) = "y" Or Left$(A$, 1) = "n" If Left$(A$, 1) = "n" Then Exit Do 'bug out main DO doesn't want to play K = 1 While Left$(A$(K), 2) = "\Q" Q$ = A$(K) Do 'parse question and use as prompt to get c$ C$ = UCase$(Left$(npt$(" " + Mid$(Q$, 3, InStr(3, Q$, "\") - 3)), 1)) Loop Until C$ = "Y" Or C$ = "N" X = InStr(3, Left$(Q$, Len(Q$) - 1), "\" + C$) Y = InStr(X + 1, Q$, "\") K = Val(Mid$(Q$, X + 2, Y - X - 2)) If Len(A$(K)) = 0 Then Exit Do ' bug out of main DO loop, out of questions Wend A$ = UCase$(npt$(" Is it a " + Right$(A$(K), Len(A$(K)) - 2))) If Left$(A$, 1) = "Y" Then Print " Why not try another animal?": _Continue 'skip rest of this loop V$ = LCase$(npt$(" The animal you were thinking of is a ")) X$ = npt$(" Please type a question that would distinguish a " + V$ + " from a " + Right$(A$(K), Len(A$(K)) - 2)) Do A$ = UCase$(Left$(npt$(" For a " + V$ + " the answer would be "), 1)) Loop Until A$ = "Y" Or A$ = "N" If A$ = "Y" Then B$ = "N" Else B$ = "Y" Z1 = Val(A$(0)) A$(0) = _Trim$(Str$(Z1 + 2)) A$(Z1) = A$(K) A$(Z1 + 1) = "\A" + V$ A$(K) = "\Q" + X$ + "\" + A$ + _Trim$(Str$(Z1 + 1)) + "\" + B$ + _Trim$(Str$(Z1)) + "\" Loop Open "ANIMAL.DAT" For Output As #2 For I = 0 To 200 Write #2, A$(I) Next I Close #2 Data "4","\QDoes it live in water\Y2\N3\","\Afish","\Abird" Function npt$ (prompt$) ' nice way to get more variable data into the prompt! Print prompt$; Input rtn$ npt$ = rtn$ End Function
'===================================== Code Notes down here to watch LOC of this app =======================================
' 2020-11-10 b+ Makeover = 2nd go at Midnight Owl's great start on conversion ' note: first mod of Midnight's converstion added UCASE$ to all INPUTs solving a little user friendly problem. ' 2020-11-10 A step further was to revise PRINT prompt : INPUT A$ : UCASE$(A$) into a single function. ' Then one time call sub routines I put back into main code includeing the MAIN SUB! ' That includes: the LIST animals SUB for LIST option (which I made known in prompt). ' The SHOW QUESTION SUB and the KEEPDATA SUB. ' I also removed the ON error and used more modern check _FILEEXISTS
' savings: admittedly some of this makes understanding of code less clear ' for X, Y use INSTR to skip FOR... NEXT loops
' From this: ' T$ = "\" + C$ ' FOR X = 3 TO LEN(Q$) - 1 ' IF MID$(Q$, X, 2) = T$ THEN EXIT FOR ' NEXT X
' to this ' X = INSTR(3, LEFT$(Q$, LEN(Q$) - 1), "\" + C$)
' and from this ' FOR Y = X + 1 TO LEN(Q$) ' IF MID$(Q$, Y, 1) = "\" THEN EXIT FOR ' NEXT Y ' to this! ' Y = INSTR(X + 1, Q$, "\")
' I decided to get rid of all the CAPITALIZATION and make normal looking sentences. So I modified the INPUT Function ' renaming it npt$ (input$ without vowels). Now if you want all caps use: UCASE$(npt$(prompt$)), same for lower ' case. Since humans swim I changed the first question: Does it live in water? Now how would you answer that for beaver? ' I hope not yes :) Nor do beavers or rabbits hibernate, I am learning myself! ' 2020-11-10 post 64 LOC down from original 73, not bad since it is complete makeover.
And it comes from Morristown which means its Classic Basic. I just gave it a memory file so you don't have to start from scratch each time you play.
You do have to be a little careful designing your yes or no question. If you make a mistake, no problem, the DAT file this uses can be edited in any WP including QB64 I am pretty sure.
@anthonyrbrown got any ideas for hacking this?
|
|