home *** CD-ROM | disk | FTP | other *** search
/ Ahoy 1985 October / Ahoy_Magazine_85-10_1985_Double_L.d64 / cd22-3 (.txt) < prev    next >
Commodore BASIC  |  2022-10-26  |  530b  |  16 lines

  1. 0 rem << cd22-3 >>
  2. 1 rem
  3. 2 rem solution to problem #18-2 :
  4. 3 rem             billiard balls
  5. 4 rem by charles goldberg
  6. 5 rem
  7. 10 d$="heavylightwhat?":print"[147] enter deflection"
  8. 20 print" left----n----right"spc(30)"o"spc(39)"n"spc(39)"e"
  9. 30 input"1-2-4-5  [209] 7-8-10-11";a$(0)
  10. 40 input"4-5-7-11 [209] 2-3- 6-12";a$(1)
  11. 50 input"6-8-9-11 [209] 5-7-10-12";a$(2)
  12. 60 foru=0to2:b=b+sgn(asc(left$(a$(u),1))-78)*3^u:a$(u)="n":next:c=abs(b)
  13. 70 e=.5+(c=10):foru=0to4:e=e+(c=int(2*1.585^u)):next:d=int(c^2-abs(c)*13)
  14. 80 print"ball";c;"is ";mid$(d$,(3.5+2.5*sgn(b*sgn(e)))*(d<>0)^2-11*(d=0),5)
  15. 90 b=0:goto 30
  16.