Listing 1 A BASIC program to play HI-LO

100 rem A very old BASIC program to play HI-LO
110 print "Think of a number between 1 and 100"
120 print "If you don't cheat, I'll figure it out"
130 print "in seven guesses or less!"
140 lo = 1
150 hi = 100
160 if lo > hi then print "You cheated!" : goto 240
170 g = int((lo + hi) / 2)
180 print "Is it";g;" (L/H/Y)?"
190 input r$
200 if r$ = "L" then lo = g+1 : goto 160
210 if r$ = "H" then hi = g-1 : goto 160
220 if r$ <> "Y" then print "What? Try again..." : goto 190
230 print "What fun!"
240 print "Wanna play again?"
250 input r$
260 if r$ = "Y" then 140