_Title "Guess number - with less help than Hi, Lo Game" 'b+ 2021-09-21
ans$ = ""
ans$
= ans$
+ Mid$("0123456789", Int(Rnd * 10) + 1, 1) guesses = 0
Print "Guess my";
3;
"digit number " 'Input "enter guess > "; g$
g$ = AI3Guess$(-1) ' <<< signal for guess with -1
Print "B+ AI guesses "; g$
guesses = guesses + 1
right = 0
Print "Your AI guess has"; right;
"right." dummy$ = AI3Guess$(right) ' >>> give the AI the feed back
Print "press any to continue..."
Function AI3Guess$
(guessOrFeedback
As Integer) ' no feedback means it guessed right and a new game started Static lastGuess$
, nRight
, tI
, a$
, b$
, c$
g$ = "000111222333444555666777888999abccabbcabacacbcba" ' 10 digits 6 combo 16 tries
If guesses
= 0 Then 'starting new game lastGuess$ = "": nRight = 0: tI = 0
If guessOrFeedback
<> -1 Then 'feedback a$
= Mid$(lastGuess$
, 1, 1): nRight
= 1 b$
= Mid$(lastGuess$
, 1, 1): nRight
= 2 c$
= Mid$(lastGuess$
, 1, 1): nRight
= 3: tI
= 10 a$
= Mid$(lastGuess$
, 1, 1): b$
= Mid$(lastGuess$
, 1, 1): nRight
= 2 b$
= Mid$(lastGuess$
, 1, 1): c$
= Mid$(lastGuess$
, 1, 1): nRight
= 3: tI
= 10 'we are going to be a little stupid for now just want to see if this works
tI = tI + 1
lastGuess$
= Mid$(g$
, (tI
- 1) * 3 + 1, 3) AI3Guess$ = lastGuess$
AI3Guess$ = lastGuess$