home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Ahoy 1985 December
/
Ahoy_Magazine_85-12_1985_Double_L.d64
/
commhilo
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2022-10-26
|
859b
|
33 lines
0 rem << commhilo - hi-lo game with ibm
1 rem - commodore program -
2 rem -- commhilo --
3 rem rupert report #24
4 rem the ibm connection
5 rem
6 print chr$(147)
10 open 2,2,0,chr$(8)+chr$(0)
20 n=int(rnd(0)*1048576)
30 n$=str$(n)
40 gosub 2000
50 if left$(r$,13)<>"pick a number" then t$="what?" : gosub 1000 : goto 40
60 t$="all right" : gosub 1000
70 print"( my number is";n;")"
80 gosub 2000 : ng=ng+1
90 g$=mid$(r$,6) :v=val(g$) :g$=str$(v)
100 if g$=n$ then 130
110 if v>n then t$=g$+" is too high" : gosub 1000 : goto 80
120 if v<n then t$=g$+" is too low" : gosub 1000 : goto 80
130 t$="that's right! my number is "+g$+". you took"+str$(ng)+" guesses."
140 gosub 1000 : gosub 2000
150 t$="you're welcome." : gosub 1000
155 rem >wait till done transmitting<
160 if peek(673) and 1 then 160
170 close 2 : end
1000 print#2,t$ :rem transmit t$
1010 return
2000 r$="" :rem receive r$
2010 get#2,a$:if a$="" then 2010
2020 if a$=chr$(13) then 2040
2030 r$=r$+a$ : goto 2010
2040 print r$ : return