home *** CD-ROM | disk | FTP | other *** search
/ DP Tool Club 12 / CD_ASCQ_12_0294.iso / vrac / qwsample.zip / LUNAR.SCR < prev    next >
Text File  |  1994-01-11  |  3KB  |  60 lines

  1. ' This is a version of the classic "Lunar Lander" game that appeared in
  2. ' computer magazines over ten years ago.  It is included here as a bit
  3. ' of fun, but also to demonstrate the flexibility of the SLIQ script
  4. ' language (the program is almost unmodified from an original one).
  5.  
  6. ' The following variable declarations are required by SLIQ (they were
  7. ' not required in the original program)
  8. dim a as real, d as real, g as real, i as real, j as real
  9. dim k as real, l as real, m as real, n as real, q as real
  10. dim s as real, t as real, v as real, w as real, z as real
  11. hostecho on  ' This statement makes the INPUT statement work correctly
  12.  
  13. 10 cls: print ,,"Lunar Lander"
  14. 25 print
  15. 30 print "This is a computer simulation of an Apollo lunar"
  16. 40 print "landing capsule.": print
  17. 50 print "The on-board computer has failed (it was running"
  18. 60 print "Windows) so you have to land the capsule manually."
  19. 70 print: print "Set burn rate of retro rockets to any value between"
  20. 80 print "0 (free fall) and 200 (maximum burn) pounds per second."
  21. 90 print "Set new burn rate every 10 seconds.": print
  22. 100 print "Capsule weight 32,500 lbs; fuel weight 16,500 lbs."
  23. 110 print: print "Good luck!"
  24. 120 l=0
  25. 130 print: print "Sec","MI + FT","MPH","Lbs fuel","Burn rate":print
  26. 140 a=120:v=1:m=33000:n=16500:g=1e-03:z=1.8
  27. 150 print l,int(a);" ";int(5280*(a-int(a))),3600*v,m-n,:input k:t=10
  28. 160 if m-n<1e-03 then 240
  29. 170 if t<1e-03 then 150
  30. 180 s=t: if m>=n+s*k then 200
  31. 190 s=(m-n)/k
  32. 200 gosub 420: if i<=0 then 340
  33. 210 if v<=0 then 230
  34. 220 if j<0 then 370
  35. 230 gosub 330: goto 160
  36. 240 print "Fuel out at ";l;" seconds":s=(-v+sqr(v*v+2*a*g))/g
  37. 250 v=v+g*s: l=l+s
  38. 260 w=3600*v: print "On moon at ";l;" seconds - Impact velocity ";w;" mph"
  39. 270 if w<=1.2 then print "Perfect landing!": goto 440
  40. 280 if w<=10 then print "Good landing (could be better)": goto 440
  41. 282 if w>60 then 300
  42. 284 print "Craft damage... You're stranded here until a rescue"
  43. 286 print "party arrives.  Hope you have enough oxygen!"
  44. 288 goto 440
  45. 300 print "Sorry, there were no survivors.  You blew it!"
  46. 310 print "In fact, you blasted a new lunar crater "w*.277;" feet deep!"
  47. 320 goto 440
  48. 330 l=l+s: t=t-s: m=m-s*k: a=i: v=j: return
  49. 340 if s<5e-03 then 260
  50. 350 d=v+sqr(v*v+2*a*(g-z*k/m)):s=2*a/d
  51. 360 gosub 420: gosub 330: goto 340
  52. 370 w=(1-m*g/(z*k))/2: s=m*v/(z*k*(w+sqr(w*w+v/z)))+.05:gosub 420
  53. 380 if i<=0 then 340
  54. 390 gosub 330: if j>0 then 160
  55. 400 if v>0 then 370
  56. 410 goto 160
  57. 420 q=s*k/m: j=v+g*s+z*(-q-q*q/2-q^3/3-q^4/4-q^5/5)
  58. 430 i=a-g*s*s/2-v*s+z*s*(q/2+q^2/6+q^3/12+q^4/20+q^5/30):return
  59. 440 print:print:print:print "Try again??": goto 70
  60.