home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Ahoy 1985 October
/
Ahoy_Magazine_85-10_1985_Double_L.d64
/
cd22-3
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2022-10-26
|
530b
|
16 lines
0 rem << cd22-3 >>
1 rem
2 rem solution to problem #18-2 :
3 rem billiard balls
4 rem by charles goldberg
5 rem
10 d$="heavylightwhat?":print"[147] enter deflection"
20 print" left----n----right"spc(30)"o"spc(39)"n"spc(39)"e"
30 input"1-2-4-5 [209] 7-8-10-11";a$(0)
40 input"4-5-7-11 [209] 2-3- 6-12";a$(1)
50 input"6-8-9-11 [209] 5-7-10-12";a$(2)
60 foru=0to2:b=b+sgn(asc(left$(a$(u),1))-78)*3^u:a$(u)="n":next:c=abs(b)
70 e=.5+(c=10):foru=0to4:e=e+(c=int(2*1.585^u)):next:d=int(c^2-abs(c)*13)
80 print"ball";c;"is ";mid$(d$,(3.5+2.5*sgn(b*sgn(e)))*(d<>0)^2-11*(d=0),5)
90 b=0:goto 30