• For a study project, I had to create a program where the computer guessed a number between 1 and 100 based on binary search. I paste it below at the very bottom. It’s nearly there but I think not quite perfect. It could perhaps be reworked better from first principles.
One thing I noticed is for example when I type in 33 as the input number for the computer to find, at one point the two previous computer guesses are 31 and 35, so the next one hopefully would have been 33, but it goes to 32 instead. I guess it’s a tiny element in the program that makes it not ideal.
I just wanted the program to find the number in seven attempts rather than eight. Maybe eight is the realistic maximum. Maybe it’s OK.
I hope I am not breaking the “spirit” of the forum by asking for precise feedback on a program. Sorry if so.
If there are no suggestions I will probably move on. I am only a beginner so am actually quite pleased that I have made this attempt. I am still working through all the tutorial notes etc (as well as trying to learn some other program basics at the same time, web, java, python… not to mention AI

• One other point. When I type in quote marks from word into SDLIDE, it doesn’t like quote marks, eg PRINT “test” gives:
PRINT ENVELOPEANDCOUNTtestENVELOPEANDDEG
I find the interface fiddly to work with cf word for example.
At least though you can edit lines with SDLIDE compared with the BBC emulator (national computer history centre, which doesn’t seem to let you edit lines at all + fussy about copy and paste etc)
Sorry for the hassle, thanks for the help. kr
PROGRAM CODE:
10 CLS
20 LET MAX = 100 : LET MIN = 0 : LET RANGE = MAX - MIN
30 PRINT "GIVE ME A NUMBER BETWEEN 1 AND 100"
40 INPUT N : H$= ""
50 PRINT "OK, HERE IT IS - "; N : PRINT
60 ATTEMPT = 1 : PRINT "NOW LET ME GUESS IT IN 8 GOs. IS IT " : PRINT
70 LET G = ((RANGE / 2) + MIN) : GUESS = INT(G) : IF H$="H" GUESS = GUESS+1
80 PRINT GUESS;"? Y or N -"; " ATTEMPT NO. ";ATTEMPT
90 INPUT A$
100 IF A$="Y" THEN PRINT "GREAT" ELSE IF A$ = "N" THEN GOTO 105 ELSE GOTO 80
101 END
105 PRINT "IS IT HIGHER OR LOWER, H or L?" : INPUT H$
107 IF H$="H" MIN = MIN+(RANGE/2) ELSE IF H$= "L" MAX = MAX-(RANGE/2)
108 RANGE = MAX - MIN
109 ATTEMPT=ATTEMPT+1 : GOTO 70