home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Loadstar 53
/
053.d81
/
golf
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2022-08-26
|
11KB
|
312 lines
5 gosub 5000
10 goto 1370
20 rem golf
30 rem ** accuracy subr **
40 z=rnd(0):z2=int(54*z)+1:ac=int(3*log(z2))-1
50 if ac<0 then ac=0
60 return
70 rem ** distance subr **
80 z=rnd(0):x=20:a=0:odl=dl
90 if cl=12 or cl=13 then 130
100 if cl=1 then x=80
110 if (cl=2 or cl=3) then x=30
120 goto 210
130 print:print"1/3, 2/3, or full (1, 2, or 3)";:x=17
140 get a$:if a$="" then 140
150 if a$="1" then 190
160 if a$="2" then a=17:goto 190
170 if a$="3" then a=34:goto 190
180 goto 140
190 print a$;:gosub 4000
200 rem sand/rough more diff longer club
210 if (pl=1 or pl=4 or pl=5 or pl=6) and cl<6 then df=.8*df
220 if (pl=1 or pl=4 or pl=5 or pl=6) and cl<3 then df=.7*df
230 di=int(df*(mr(cl)+(x*z)+a+1))
240 rem alter dist hit outside of range
250 z=rnd(0):x=int(5*z)+1:if x<>4 then 290
260 z=rnd(0):x=int(3*z)+1:if x=2 then 280
270 di=int(.9*di):goto 290
280 di=int(1.1*di):goto 290
290 return
300 rem ** trouble type subr **
310 z=rnd(0):pl=int(6*z)+1
320 return
330 rem ** trouble subr **
340 df=1
350 on pl goto 370,430,470,620,370,620
360 rem rough
370 z=rnd(0):if ((int(2*z)+1)=1) then 400
380 print:print"your ball is in the right rough"
390 printdl;"yards from the pin":df=.9:tr=1:goto 680
400 print:print"your ball is in the left rough"
410 printdl;"yards from the pin":df=.9:tr=1:goto 680
420 rem water
430 z=rnd(0):wa=int(3*z)+1:print:print wa$(wa)
440 dl=dl+10:print"after dropping back it's":print dl;"yards from the pin"
450 sr(i)=sr(i)+1:goto 680
460 rem woods
470 z=rnd(0):wo=int(10*z)+1:if wo<>7 then 510
480 print:print"aren't you the lucky one. your ball hit"
490 print"a couple of trees and then bounced into"
500 print"the fairway ";dl;"yards from the green":goto 680
510 z=rnd(0):wo=int(3*z):if wo<>1 then 560
520 dl=odl:lo=1:sr(i)=sr(i)+1
530 print:print"that one's long gone. you might as well"
540 print"not even look for it. your ball is "
550 print dl;"yards from the pin again":goto 680
560 tr=1:print:print"your ball is ";dl;"yards from the pin"
570 print"behind some trees, and in a bad lie. "
580 print"try to chip it back into":print"into play with a pitching wedge"
590 pw$="y"
600 goto 680
610 rem sand
620 tr=1:if dl<=50 then 660
630 print:print "you are in a bunker";dl;"yds from the pin"
640 z=rnd(0):t=int(z*10):if t=4 then df=1:goto 680
650 z=rnd(0):df=int(z*6)/10+.3:goto 680
660 print:print"you are in a green side bunker":printdl;"yds from the pin"
670 z=rnd(0):df=int(z*5)/10+.5
680 return
690 rem ** choose club subr **
700 print"which club ? [157][157][157][157]";
710 get a$:if a$="" then 710
711 ifa$=chr$(13) then 4100
720 if(a$>="1"anda$<="9")ora$="p"ora$="s"ora$="c"then print a$;:goto 740
730 goto 710
740 get b$:if b$="" then 740
750 print b$;:if asc(b$)=20 or asc(b$)=157 then goto 710
751 if b$=chr$(13) then print:print"[145][145]";:goto 700
760 if b$="w" and (a$>="1" and a$<="3") then cl=asc(a$)-48:goto 820
770 if b$="i" and (a$>="2" and a$<="9") then cl=asc(a$)-48+2:goto 820
780 if a$+b$="pw" then cl=12:goto 820
790 if a$+b$="sw" then cl=13:goto 820
800 if a$+b$="cl" then gosub 1900:goto 700
810 print:print"[145]";bl$;"[145]";:goto 700
820 gosub4000:sr(i)=sr(i)+1
830 if cl<>1 or (sr(i)<2 or lo=1) then 880
840 rem prevent driver off fairway
850 z=rnd(0):dl=dl-(int(17*z)+1)
860 print:print"a duff. your ball is now";dl;"yards":print"from the hole."
870 print"even the pros don't try that one.":goto 700
880 if pw$<>"y" or cl=12 then 930
890 rem should have followed caddie
900 dl=dl+13:print:print"nice job - it bounced off of a tree."
910 print"now your're in the fairway":print dl;"yards from the pin"
920 sr(i)=sr(i)+1:pw$="n":goto 700
930 pw$="n":return
940 rem ** putting subr **
950 dl=dl*3:if tr=1 then ac=ac*1.25
960 rem if cl>11 and dl>0 and tr=0 then 803
970 dl=int((dl^2+ac^2)^0.5)
980 ifac<3andabs(dl)<10thenprint:print:print"nice shot - it hit the pin !"
990 if dl>1 then 1030
1000 z=rnd(0):x=int(z*7)+1
1010 if x=3 then print:print"too bad - your ball is on the lip":goto 1040
1020 print:print"your ball is 1 foot from the hole":goto 1040
1030 print:print"your ball is";dl;"feet from the hole"
1040 print"putting stroke (1-7)";
1050 get a$:if a$="" then 1050
1060 printa$;:p=asc(a$)-48:if p<1 or p>7 then print:goto 1040
1070 sr(i)=sr(i)+1 :gosub 4000
1080 z=rnd(0):di=int(10*z)+(p-1)*10+1
1090 if dl<2 and p=1 then 1220
1100 if dl<10 and abs(dl-di)>4 and p<2 then 1080
1110 if dl>6 or abs(dl-di)<4 then 1130
1120 z=rnd(0):x=int(4*z)+1:if x<>3 then di=dl
1130 if dl<26 or abs(dl-di)>3 then 1150
1140 z=rnd(0):z2=int(7*z)+1:ifz2<>2thenz=rnd(0):dl=int(15*z)+1:goto 1160
1150 dl=dl-di:if abs(dl)<4 then 1220
1160 if di<15 then print:print"dribble...":goto 1180
1170 print:print"dribble..trickle.."
1180 if dl>0 then dl=dl-2:goto 990
1190 dl=dl+2
1200 ifdl=-1thenprint:print"too much-you slid by 1 foot";:dl=-dl:goto 1020
1210 print:print"too much-you slid by";:dl=-dl: printdl;"feet";:goto 1030
1220 if di<6 then print:print"...plunk":goto 1260
1230 if di<15 then print:print"trickle...plunk":goto 1260
1240 if di<25 then print:print"dribble..trickle..plunk":goto 1260
1250 print:print"squiggle..dribble..trickle..plunk"
1260 print"in the hole"
1270 return
1280 data 4,8,11,15,20,24,27,32,36,40,43,47,52,56,60,63,68,72
1290 data 301,347,152,407,485,390,212,515,337
1300 data 385,179,420,614,414,432,225,530,440
1310 data 4,4,3,4,5,4,3,5,4,4,3,4,5,4,4,3,5,4
1320 data 20,22,18,20,27,20,21,25,21,23,15,23,28,22,23,20,18,19
1330 data 20,20,20,25,30,25,10,30,20,23,20,25,30,30,30,20,30,28
1340 data 210,200,180,170,160,150,140,130,120,110,100,50,0
1350 data 210-290,200-230,180-210,170-190,160-180,150-170,140-160,130-150
1360 data 120-140,110-130,100-120,50-100,0-50
1370 print"[147]"
1380 dim cn$(14),na$(4),yd(18),pa(18),gs(18),tp(18),mr(13),mr$(13),ts(4)
1390 dim pd(4),sr(4),fw(18),pm$(7)
1400 wa$(1)="your ball landed in a creek"
1410 wa$(2)="do you have scuba diving equipment with you? its in a pond"
1420 wa$(3)="splash! you'll have a hard time finding it - its in a lake"
1430 x=rnd(ti):fori=1to40:bl$=bl$+" ":next
1440 pm$(1)="double eagle!!":pm$(2)="eagle!":pm$(3)="birdie":pm$(4)="par"
1450 pm$(5)="bogey":pm$(6)="double bogey":pm$(7)="triple bogey"
1460 fori=1to18:read tp(i):next:for i=1to18:read yd(i):next
1470 fori=1to18:read pa(i):next
1480 for i=1to18:read gs(i):next:for i=1to18:read fw(i):next
1490 for i=1to13:read mr(i):next:for i=1to13:read mr$(i):next
1500 poke 53280,5:poke 53281,5
1510 print"[147]welcome to the tanglewood country club."
1520 print" do you want instructions (y/n)?";
1530 get a$:if a$="" then 1530
1540 print a$;:if a$="n" then 1760
1550 print"[147]welcome to the [153]tanglewood country club,"
1560 print" a simulated golf course. available "
1570 print" for you is a full set of clubs "
1580 print"consisting of the following, along with"
1590 print" expected ranges & selection codes.":print
1600 print"[158]club";tab(8)"[158]range";tab(15);"[158]code";tab(21)"[158]club";
1610 print tab(28);"[158]range";tab(35);"[158]code":print"[146]"
1620 fori=1to3:print"[151]"str$(i)"wood"tab(7)""mr$(i)tab(15);""str$(i);"w":next
1630 fori=4to6:print"[151]"str$(i-2)"iron";tab(7)""mr$(i)tab(15)""str$(i-2);"i"
1640 next:print"";:print
1650 fori=7to11
1660 printtab(20)"[151]"str$(i-2);"iron";
1665 printtab(27)""mr$(i);tab(35)""str$(i-2);"i":next
1670 print tab(20);"[151] pw ";tab(28)""mr$(12);tab(35);" pw"
1680 print tab(20);"[151] sw ";tab(29)""mr$(13);tab(35);" sw"
1690 print:print"the course is 6785 yds. long with a par"
1700 print"of 72, and has plenty of rough, water,"
1710 print"trees & bunkers. i will caddie for you"
1720 print"(at a modest rate) & i know the course"
1730 print"pretty well. as in a real game of golf,"
1740 print"unexpected triumphs and disasters lay "
1750 print"ahead of you. good luck and have fun!"
1751 print" press any key to continue.
1752 [161]a$:[139]a$[178]"" [167] 1752
1760 [153]"load number of players poke(1-4poke)";
1770 [161] a$:[139] a$[178]"" [167] 1770
1780 [153] a$:[139] a$[179]"1" [176] a$[177]"4" [167] 1760
1790 np[178][198](a$)[171]48:[129]i[178]1[164]np
1800 na$(i)[178]"":[153]"loadsys player #";i
1805 [153]"