home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Run Magazine ReRun 1984 Half 2
/
rerun-1984-07-12.d64
/
64touchdown
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2022-09-20
|
5KB
|
232 lines
10 def fna(z)=int(z*rnd(1)*(rnd(1)-.2))
20 def fnb(z)=int(z*rnd(1)*(rnd(1)-.5))
30 z=rnd(-ti):rem set seed
40 dim f(20,3):rem positions
50 gosub 1420:rem setup
60 input"[147] heads or tails";flip$:print"[147]"
70 coin$(1)="h":coin$(2)="t":t=100:you=0:me=0
80 r=int(2*rnd(1))+1
90 if left$(flip$,1)=coin$(r) then 0130
100 print" you lost the toss,";:print" i receive!"
110 for j=1towt:next
120 p=1:gosub 1210:goto 0170
130 print" you won the toss,";:print" you receive!"
140 for j=1towt:next
150 p=2:gosub 1210:goto 0170
160 gosub 1210
170 t=t-1:rem count
180 if t>0 then 0210
190 print "[147]";spc(15);"game over":print:print spc(15);"final score:"
195 print spc(15);" you ";you:print spc(15);" me ";me
200 end
210 fs$=str$(fst-yd)
220 if fst>99 then fs$=" goal"
230 print"";b$;" time";t:print b$;" you";you;", me";me
235 print b$;" ";d$(dwn);" and";fs$;
240 sysps:printb$:printb$;"[145]";
250 if p=1 then print" play?"
260 if p=2 then print" defense?"
280 get a$:if a$="" then 0280
290 if a$="?" then gosub 2060:gosub 1660:goto 0210
300 if (a$<"0") or (a$>"6") then 0280
310 play=val(a$)
320 print"[145] "
330 if p=1 then 0440
340 df=play
350 play=int(4*rnd(1))+1
360 if dwn<4 then if play<4 then if me<you then play=play+1
370 if dwn<4 then 0470
380 z=play
390 if z=4 then z=3
400 play=5
410 if 100-yd<=30 then play=6
420 if t<25 then if fst-yd<4 then if me<you then play=z+1
430 goto 0470
440 df=int(4*rnd(1))+1
450 if df<4 then if fst-yd>5 then df=df+1
460 if you<me then if df<4 then df=df+1
470 d=play-df
480 if d<0 then d=-d
490 d=(d-1)*30
500 if play>4 then on play-4 goto 0800,0890
510 sys ps
520 ifp=1then print " play ";pl$(play)
530 ifp=2 then print" def ";df$(df)
540 for j=1towt:next
550 ifp=1then print" def ";df$(df)
560 ifp=2then print" play ";pl$(play)
570 for j=1towt:next
580 print"[145][145] ":print" "
590 m=mx(play)
600 x=int(d*m/700)
610 x=x+fna(m):if x+yd>100 then x=101-yd
611 for i=0 to x step sgn(x)
612 sys ps:print " ";i;
613 for j=1to150:next
614 next
615 print" yards";""
617 for j=1towt:next
618 print"[145] "
620 yd=yd+x
630 if yd>100 then 1060
640 if yd<0 then 1280
650 q=int(100*rnd(1))
660 if q<play*5/2 then 1330
670 if yd<fst then yd=yd-x:gosub 1930:goto 0710
680 fst=yd+10
690 dwn=0
700 gosub 1660
710 dwn=dwn+1
720 if dwn<5 then 0170
730 sysps:print b$;" out of downs!"
740 for j=1towt:next
750 yd=100-yd
760 fst=yd+10
770 dwn=1
780 p=3-p:gosub 1660
790 goto 0170
800 x=40+fnb(40)
810 sysps:print b$;" punt was ";x;" yards"
820 for j=1towt:next
830 yd=100-(yd+x)
840 if yd<0 then yd=20
850 fst=yd+10
860 dwn=1
870 p=3-p:gosub 1660
880 goto 0170
890 sysps:print b$;" field goal ";
900 for j=1towt:next
910 x=20+fna(50)
920 if 100-yd<x then 1010
930 print"wide!"
940 for j=1towt:next
950 if yd>80 then yd=80
960 yd=100-yd
970 p=3-p
980 fst=yd+10
990 dwn=1:gosub 1660
1000 goto 0170
1010 print"good!"
1020 for j=1towt:next
1030 if p=1 then you=you+3
1040 if p=2 then me=me+3
1050 goto 0160
1060 sys ps:print b$;" touchdown!!!!"
1070 sc=6
1080 for j=1towt:next
1090 sys ps:print b$;" extra point ";
1100 for j=1 to wt:next
1110 x=10+fna(50)
1120 if x<10 then 1160
1130 print"good!!"
1140 sc=sc+1
1150 goto 1170
1160 print"blocked!!"
1170 if p=1 then you=you+sc
1180 if p=2 then me=me+sc
1190 for j=1towt:next
1200 goto 0160
1210 rem kickoff
1220 yd=20
1230 yd=yd+fnb(40)
1240 fst=yd+10
1250 p=3-p
1260 dwn=1:gosub 1660
1270 return
1280 sys ps:print b$;" safety!!"
1290 for j=1towt:next
1300 if p=1 then me=me+2
1310 if p=2 then you=you+2
1320 goto 0160
1330 if play<3 then sys ps:print b$;" fumble!!"
1340 if play>2 then sys ps:print b$;" interception!!"
1350 for j=1towt:next
1360 yd=100-yd
1370 fst=yd+10
1380 dwn=1
1390 p=3-p
1400 gosub 1660
1410 goto 0170
1420 rem
1430 rem set up labels
1440 rem
1450 data 0,5,10,15,20,25,30,35,40,45,50,55,60,65,70,75,80,85,90,95,100
1460 data 0,5,10,15,20,25,30,35,40,45,50,45,40,35,30,25,20,15,10,5,0
1470 for i=0 to 20
1480 j=20-i
1490 read f(i,1):f(j,2)=f(i,1)
1500 next
1510 for i=0 to 20:read f(i,3):next
1520 data 25,38,25,75
1530 for i=1 to 4
1540 read mx(i)
1550 next
1560 poke 782,0:poke 781,19:ps=65520
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]"
1580 wt=2000
1585 poke 53280,6
1590 poke 53281,5:print"";
1600 p$(1)=">":p$(2)="<"
1610 d$(1)="1st":d$(2)="2nd":d$(3)="3rd":d$(4)="4th"
1620 data draw,sweep,s. pass,l. pass,punt,f. goal
1630 for i=1 to 6
1640 read pl$(i):df$(i)=pl$(i):next
1650 return
1660 rem
1670 rem print field
1680 rem
1690 s=int(yd/5+.5):if p=2 then s=20-s
1700 if p=1 then s=s-2
1710 if p=2 then s=s-4
1720 if s<0 then s=0
1730 if s>14 then s=14
1740 print"";b$:printb$:printb$
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]"
1760 for i=1 to 12
1770 print" [161][146] [161][146] [161][146] [161][146] [161][146] [161][146] [161][146]"
1780 next
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]"
1795 print b$;
1800 for i=0 to 6
1810 f$=str$(f(s+i,3)):f$=right$(f$,len(f$)-1)
1820 print tab(i*5+5);f$;
1825 if len(f$)=1 then print" ";
1830 next
1840 if p=1 then tb=fst-f(s,p)-5
1850 if p=2 then tb=f(s,p)-fst+5
1860 print"";
1870 if tb>=5 and tb<36 then print tab(tb);"[216]";
1880 if tb+10>=5 and tb+10<36 then print tab(tb+10);"[216]";
1890 if p=1 then tb=yd-f(s,p)+5
1900 if p=2 then tb=f(s,p)-yd+5
1910 print "";tab(tb);p$(p);""
1920 return
1930 rem
1940 rem move player
1950 rem
1960 if p=1 then tb=yd-f(s,p)+5
1970 if p=2 then tb=f(s,p)-yd+5
1980 print"";tab(tb);" ";
1990 yd=yd+x
2000 if p=1 then tb=yd-f(s,p)+5
2010 if p=2 then tb=f(s,p)-yd+5
2020 if tb<5 or tb>35 then gosub 1660:return
2030 for j=1 to wt/4:next
2040 print"";tab(tb);p$(p);""
2050 return
2060 rem
2070 rem display plays
2080 rem
2090 print"[147]"
2100 print" plays[146]"
2110 print
2120 print"1 = draw"
2130 print"2 = sweep"
2140 print"3 = short pass"
2150 print"4 = long pass"
2160 print"5 = punt(offense only)"
2170 print"6 = f.g.(offense only)"
2180 print:print"(hit any key to cont)"
2190 get a$:if a$=""then 2190
2200 print"[147]":return