home *** CD-ROM | disk | FTP | other *** search
/ Run Magazine ReRun 1984 Half 2 / rerun-1984-07-12.d64 / 64touchdown (.txt) < prev    next >
Commodore BASIC  |  2022-09-20  |  5KB  |  232 lines

  1. 10 def fna(z)=int(z*rnd(1)*(rnd(1)-.2))
  2. 20 def fnb(z)=int(z*rnd(1)*(rnd(1)-.5))
  3. 30 z=rnd(-ti):rem set seed
  4. 40 dim f(20,3):rem positions
  5. 50 gosub 1420:rem setup
  6. 60 input"[147]          heads or tails";flip$:print"[147]"
  7. 70 coin$(1)="h":coin$(2)="t":t=100:you=0:me=0
  8. 80 r=int(2*rnd(1))+1
  9. 90 if left$(flip$,1)=coin$(r) then 0130
  10. 100 print"     you lost the toss,";:print" i receive!"
  11. 110 for j=1towt:next
  12. 120 p=1:gosub 1210:goto 0170
  13. 130 print"     you won the toss,";:print" you receive!"
  14. 140 for j=1towt:next
  15. 150 p=2:gosub 1210:goto 0170
  16. 160 gosub 1210
  17. 170 t=t-1:rem count
  18. 180 if t>0 then 0210
  19. 190 print "[147]";spc(15);"game over":print:print spc(15);"final score:"
  20. 195 print spc(15);" you ";you:print spc(15);" me  ";me
  21. 200 end
  22. 210 fs$=str$(fst-yd)
  23. 220 if fst>99 then fs$=" goal"
  24. 230 print"";b$;"     time";t:print b$;"     you";you;", me";me
  25. 235 print b$;"     ";d$(dwn);" and";fs$;
  26. 240 sysps:printb$:printb$;"[145]";
  27. 250 if p=1 then print"     play?"
  28. 260 if p=2 then print"     defense?"
  29. 280 get a$:if a$="" then 0280
  30. 290 if a$="?" then gosub 2060:gosub 1660:goto 0210
  31. 300 if (a$<"0") or (a$>"6") then 0280
  32. 310 play=val(a$)
  33. 320 print"[145]                    "
  34. 330 if p=1 then 0440
  35. 340 df=play
  36. 350 play=int(4*rnd(1))+1
  37. 360 if dwn<4 then if play<4 then if me<you then play=play+1
  38. 370 if dwn<4 then 0470
  39. 380 z=play
  40. 390 if z=4 then z=3
  41. 400 play=5
  42. 410 if 100-yd<=30 then play=6
  43. 420 if t<25 then if fst-yd<4 then if me<you then play=z+1
  44. 430 goto 0470
  45. 440 df=int(4*rnd(1))+1
  46. 450 if df<4 then if fst-yd>5 then df=df+1
  47. 460 if you<me then if df<4 then df=df+1
  48. 470 d=play-df
  49. 480 if d<0 then d=-d
  50. 490 d=(d-1)*30
  51. 500 if play>4 then on play-4 goto 0800,0890
  52. 510 sys ps
  53. 520 ifp=1then print "     play ";pl$(play)
  54. 530 ifp=2 then print"     def  ";df$(df)
  55. 540 for j=1towt:next
  56. 550 ifp=1then print"     def  ";df$(df)
  57. 560 ifp=2then print"     play ";pl$(play)
  58. 570 for j=1towt:next
  59. 580 print"[145][145]                    ":print"                    "
  60. 590 m=mx(play)
  61. 600 x=int(d*m/700)
  62. 610 x=x+fna(m):if x+yd>100 then x=101-yd
  63. 611 for i=0 to x step sgn(x)
  64. 612 sys ps:print "     ";i;
  65. 613 for j=1to150:next
  66. 614 next
  67. 615 print" yards";""
  68. 617 for j=1towt:next
  69. 618 print"[145]                 "
  70. 620 yd=yd+x
  71. 630 if yd>100 then 1060
  72. 640 if yd<0 then 1280
  73. 650 q=int(100*rnd(1))
  74. 660 if q<play*5/2 then 1330
  75. 670 if yd<fst then yd=yd-x:gosub 1930:goto 0710
  76. 680 fst=yd+10
  77. 690 dwn=0
  78. 700 gosub 1660
  79. 710 dwn=dwn+1
  80. 720 if dwn<5 then 0170
  81. 730 sysps:print b$;"     out of downs!"
  82. 740 for j=1towt:next
  83. 750 yd=100-yd
  84. 760 fst=yd+10
  85. 770 dwn=1
  86. 780 p=3-p:gosub 1660
  87. 790 goto 0170
  88. 800 x=40+fnb(40)
  89. 810 sysps:print b$;"     punt was ";x;" yards"
  90. 820 for j=1towt:next
  91. 830 yd=100-(yd+x)
  92. 840 if yd<0 then yd=20
  93. 850 fst=yd+10
  94. 860 dwn=1
  95. 870 p=3-p:gosub 1660
  96. 880 goto 0170
  97. 890 sysps:print b$;"     field goal ";
  98. 900 for j=1towt:next
  99. 910 x=20+fna(50)
  100. 920 if 100-yd<x then 1010
  101. 930 print"wide!"
  102. 940 for j=1towt:next
  103. 950 if yd>80 then yd=80
  104. 960 yd=100-yd
  105. 970 p=3-p
  106. 980 fst=yd+10
  107. 990 dwn=1:gosub 1660
  108. 1000 goto 0170
  109. 1010 print"good!"
  110. 1020 for j=1towt:next
  111. 1030 if p=1 then you=you+3
  112. 1040 if p=2 then me=me+3
  113. 1050 goto 0160
  114. 1060 sys ps:print b$;"     touchdown!!!!"
  115. 1070 sc=6
  116. 1080 for j=1towt:next
  117. 1090 sys ps:print b$;"     extra point ";
  118. 1100 for j=1 to wt:next
  119. 1110 x=10+fna(50)
  120. 1120 if x<10 then 1160
  121. 1130 print"good!!"
  122. 1140 sc=sc+1
  123. 1150 goto 1170
  124. 1160 print"blocked!!"
  125. 1170 if p=1 then you=you+sc
  126. 1180 if p=2 then me=me+sc
  127. 1190 for j=1towt:next
  128. 1200 goto 0160
  129. 1210 rem kickoff
  130. 1220 yd=20
  131. 1230 yd=yd+fnb(40)
  132. 1240 fst=yd+10
  133. 1250 p=3-p
  134. 1260 dwn=1:gosub 1660
  135. 1270 return
  136. 1280 sys ps:print b$;"     safety!!"
  137. 1290 for j=1towt:next
  138. 1300 if p=1 then me=me+2
  139. 1310 if p=2 then you=you+2
  140. 1320 goto 0160
  141. 1330 if play<3 then sys ps:print b$;"     fumble!!"
  142. 1340 if play>2 then sys ps:print b$;"     interception!!"
  143. 1350 for j=1towt:next
  144. 1360 yd=100-yd
  145. 1370 fst=yd+10
  146. 1380 dwn=1
  147. 1390 p=3-p
  148. 1400 gosub 1660
  149. 1410 goto 0170
  150. 1420 rem
  151. 1430 rem set up labels
  152. 1440 rem
  153. 1450 data 0,5,10,15,20,25,30,35,40,45,50,55,60,65,70,75,80,85,90,95,100
  154. 1460 data 0,5,10,15,20,25,30,35,40,45,50,45,40,35,30,25,20,15,10,5,0
  155. 1470 for i=0 to 20
  156. 1480 j=20-i
  157. 1490 read f(i,1):f(j,2)=f(i,1)
  158. 1500 next
  159. 1510 for i=0 to 20:read f(i,3):next
  160. 1520 data 25,38,25,75
  161. 1530 for i=1 to 4
  162. 1540 read mx(i)
  163. 1550 next
  164. 1560 poke 782,0:poke 781,19:ps=65520
  165. 1570 b$="                          [157][157][157][157][157][157][157][157][157][157][157][157][157][157][157][157][157][157][157][157][157][157][157][157][157][157]"
  166. 1580 wt=2000
  167. 1585 poke 53280,6
  168. 1590 poke 53281,5:print"";
  169. 1600 p$(1)=">":p$(2)="<"
  170. 1610 d$(1)="1st":d$(2)="2nd":d$(3)="3rd":d$(4)="4th"
  171. 1620 data draw,sweep,s. pass,l. pass,punt,f. goal
  172. 1630 for i=1 to 6
  173. 1640 read pl$(i):df$(i)=pl$(i):next
  174. 1650 return
  175. 1660 rem
  176. 1670 rem print field
  177. 1680 rem
  178. 1690 s=int(yd/5+.5):if p=2 then s=20-s
  179. 1700 if p=1 then s=s-2
  180. 1710 if p=2 then s=s-4
  181. 1720 if s<0 then s=0
  182. 1730 if s>14 then s=14
  183. 1740 print"";b$:printb$:printb$
  184. 1750 print"     [172][162][162][162][162][162][162][162][162][162][162][162][162][162][162][162][162][162][162][162][162][162][162][162][162][162][162][162][162][162][162]"
  185. 1760 for i=1 to 12
  186. 1770 print"     [161][146]    [161][146]    [161][146]    [161][146]    [161][146]    [161][146]    [161][146]"
  187. 1780 next
  188. 1790 print"     [188][162][162][162][162][162][162][162][162][162][162][162][162][162][162][162][162][162][162][162][162][162][162][162][162][162][162][162][162][162][162][146]"
  189. 1795 print b$;
  190. 1800 for i=0 to 6
  191. 1810 f$=str$(f(s+i,3)):f$=right$(f$,len(f$)-1)
  192. 1820 print tab(i*5+5);f$;
  193. 1825 if len(f$)=1 then print" ";
  194. 1830 next
  195. 1840 if p=1 then tb=fst-f(s,p)-5
  196. 1850 if p=2 then tb=f(s,p)-fst+5
  197. 1860 print"";
  198. 1870 if tb>=5 and tb<36 then print tab(tb);"[216]";
  199. 1880 if tb+10>=5 and tb+10<36 then print tab(tb+10);"[216]";
  200. 1890 if p=1 then tb=yd-f(s,p)+5
  201. 1900 if p=2 then tb=f(s,p)-yd+5
  202. 1910 print "";tab(tb);p$(p);""
  203. 1920 return
  204. 1930 rem
  205. 1940 rem move player
  206. 1950 rem
  207. 1960 if p=1 then tb=yd-f(s,p)+5
  208. 1970 if p=2 then tb=f(s,p)-yd+5
  209. 1980 print"";tab(tb);" ";
  210. 1990 yd=yd+x
  211. 2000 if p=1 then tb=yd-f(s,p)+5
  212. 2010 if p=2 then tb=f(s,p)-yd+5
  213. 2020 if tb<5 or tb>35 then gosub 1660:return
  214. 2030 for j=1 to wt/4:next
  215. 2040 print"";tab(tb);p$(p);""
  216. 2050 return
  217. 2060 rem
  218. 2070 rem display plays
  219. 2080 rem
  220. 2090 print"[147]"
  221. 2100 print"        plays[146]"
  222. 2110 print
  223. 2120 print"1 = draw"
  224. 2130 print"2 = sweep"
  225. 2140 print"3 = short pass"
  226. 2150 print"4 = long pass"
  227. 2160 print"5 = punt(offense only)"
  228. 2170 print"6 = f.g.(offense only)"
  229. 2180 print:print"(hit any key to cont)"
  230. 2190 get a$:if a$=""then 2190
  231. 2200 print"[147]":return
  232.