Source Code
1 REM initialise
5 POKE 23609,100: RANDOMIZE : PAPER 7: INK 0: BRIGHT 0: OVER 0: FLASH 0: BORDER 7: CLS
7 PRINT AT 2,8; PAPER 1; INK 7;"WE WELCOME YOU";AT 5,12;"TO THE";AT 9,6;"SPECTRUM GOLF CLUB";AT 11,1;"(Professional, Clive Sinclair)"
10 DEF FN x(h)=(INT (h/100)): DEF FN y(h,x)=(h-100*x)
15 DIM h(18): LET w$="<^>\r"
19 REM load holes
20 DIM h$(18,20,4): RESTORE
25 FOR m=1 TO 18
30 FOR n=1 TO 17: READ q: LET h$(m,n)=STR$ q: NEXT n
35 NEXT m
40 LET finish=4000: LET stream=1600: LET print=1500: LET tee=1000: LET bunker=1050: LET green=1100: LET hole=1150
45 LET bot r=1300: LET top r=1200: LET trees=1400: LET lake=1550
50 DIM s(18): DIM l(18): DIM p(18)
55 FOR n=1 TO 18
60 READ l(n): READ p(n): READ s(n)
65 NEXT n
70 REM LOAD UDG
75 FOR n=USR "a" TO 65535: READ u: POKE n,u: NEXT n
79 REM start
80 LET hl=0
90 PRINT AT 14,1;"If you need further advice on"'" playing the course then please"'" press 1 otherwise please"'" press enter."
95 INPUT " 1 for Instructions ";q$
100 IF q$="1" THEN CLS : GO SUB 2000
105 CLS : PRINT AT 2,1;"Please inform the professional"'" of your name and handicap."'" (0 - 24)"
110 INPUT "NAME ";n$
115 INPUT "HANDICAP "; LINE q$
120 IF q$<"0" OR q$>"9" THEN GO TO 115
125 IF VAL q$<0 OR VAL q$>24 THEN GO TO 115
135 PRINT AT 6,1;"Please press any key when you "'" are ready for the first hole."
139 LET hc=VAL q$
145 PAUSE 0
149 REM main loop
150 PAPER 4: INK 0: BRIGHT 0: OVER 0: FLASH 0: BORDER 7: CLS
155 LET hl=hl+1
160 IF hl=19 THEN GO TO finish
165 LET t1=0: LET ob1=0: LET sc=0: LET cg=163: LET cga=32: LET s1=0: LET r1=0: LET t1=0: LET w1=0: LET g1=0
169 REM print display
170 GO SUB top r
180 GO SUB bot r
190 LET t1=6: LET t2=4: LET t3=5: GO SUB trees
200 LET t1=9: LET t2=7: LET t3=8: GO SUB trees
210 FOR n=10 TO 12: LET b1=n: GO SUB bunker: NEXT n
215 GO SUB lake
220 GO SUB stream
225 GO SUB green
230 GO SUB hole
235 GO SUB tee
240 GO SUB print
245 GO SUB 7050
299 REM hit ball
300 IF w1 THEN LET w1=0: GO TO 3150
305 INPUT "CLUB ? "; LINE l$
307 IF l$="" THEN GO TO 305
310 IF l$(1)="(sp)" THEN GO TO 305
315 IF l$(1)="p" THEN GO TO 3300
320 IF l$(1)="w" THEN LET c=10: GO TO 360
325 IF LEN l$>1 THEN IF l$(1 TO 2)="sw" AND s1<>1 THEN LET c=12: GO TO 360
330 IF LEN l$>1 THEN IF l$(1 TO 2)="sw" AND s1=1 THEN LET l2=INT (RND*41): LET s1=0: GO TO 375
340 LET cw=0: IF LEN l$>1 THEN IF l$(2)="w" THEN LET l$=l$(1): LET cw=20
345 IF LEN l$>1 THEN GO TO 305
350 LET c=VAL l$(1)
360 LET l1=(220-c^2)-c*2+cw
370 LET l2=l1-(hc/c)
375 INPUT "% SWING ? (30 TO 100)"; LINE s$
380 IF s$="" THEN GO TO 375
385 IF s$="100" THEN GO TO 390
387 IF s$(1)<"3" OR s$(1)>"9" THEN GO TO 375
388 IF VAL s$>100 THEN GO TO 375
390 LET sw=VAL s$
395 LET l=(l2/20)*(sw/100)*s(hl)
400 INPUT "direction. clock ";d$
405 IF d$="" THEN GO TO 400
410 IF d$<"1" OR d$>"9" THEN GO TO 400
415 IF VAL d$>12 THEN GO TO 400
420 IF r1 THEN LET r1=0: GO SUB 3050
425 IF s1 AND l$<>"sw" THEN GO TO 3000
430 GO SUB 3350
440 LET da=(VAL d$)*PI/6+da1
455 IF t1 THEN LET t1=0: GO SUB 3020
460 LET yd=(l*SIN da)+by+wy*l/5: LET xd=bx-(l*COS da)+wx*l/5
465 IF xd<1 THEN LET xd=1: LET ob1=1
470 IF xd>20 THEN LET xd=20: LET ob1=1
475 IF yd<0 THEN LET yd=0: LET ob1=1
480 IF yd>31 THEN LET yd=31: LET ob1=1
499 REM move ball
500 POKE 23693,cga
510 PRINT AT bx,by;CHR$ cg
515 IF ob1 THEN GO SUB 7000
520 LET x=xd: LET y=yd: GO SUB 9000
525 LET cg=i: LET cga=ATTR (xd,yd)
530 PRINT AT xd,yd; BRIGHT 8; INK 7; PAPER 8;"\h"
535 LET bx=xd: LET by=yd
540 IF CHR$ cg="\a" OR CHR$ cg="\c" OR CHR$ cg="\d" OR CHR$ cg="\e" OR CHR$ cg="\f" OR CHR$ cg="\g" OR CHR$ cg="\o" OR CHR$ cg="\u" THEN LET g1=1
545 IF g1 THEN PRINT AT xd,yd; OVER 1; PAPER 5; INK 7;"( ) "
550 IF CHR$ cg="\b" THEN LET s1=1
555 IF CHR$ cg="\p" THEN LET r1=1
560 IF CHR$ cg="\m" OR CHR$ cg="\n" THEN LET t1=1
565 IF CHR$ cg="\s" OR CHR$ cg="\i" OR CHR$ cg="\j" OR CHR$ cg="\k" OR CHR$ cg="\l" THEN LET w1=1
580 IF s1 THEN PRINT AT xd,yd; OVER 1; INK 7; PAPER 6;"( )"
585 LET sc=sc+1
595 PRINT AT 21,23; INK 0; PAPER 5;"score ";sc
600 IF CHR$ cg="\q" THEN GO TO 3250
610 GO TO 300
998 STOP
999 REM tee
1000 LET h=VAL h$(hl,1)
1010 LET x=FN x(h): LET y=FN y(h,x)
1020 PRINT AT x,y; INK 0;"\t"
1030 LET bx=x: LET by=y
1040 RETURN
1049 REM bunker
1050 IF h$(hl,b1)="9999" THEN RETURN
1060 LET h=VAL h$(hl,b1)
1070 LET x=FN x(h): LET y=FN y(h,x)
1080 PRINT AT x,y; INK 6; PAPER 4;"\b"
1085 RETURN
1099 REM green
1100 LET h=VAL h$(hl,2)
1110 LET x=FN x(h): LET y=FN y(h,x)
1120 PRINT AT x,y; INK 5; PAPER 4;"\o\a\d";AT x+1,y;"\u\a\g";AT x+2,y;"\e\o\f"
1130 RETURN
1149 REM hole
1150 LET h=VAL h$(hl,3)
1160 LET x=FN x(h): LET y=FN y(h,x)
1170 PRINT AT x+1,y; PAPER 5; INK 0;"\q"
1180 RETURN
1199 REM top rough
1200 IF h$(hl,16)="9999" THEN RETURN
1210 LET h=VAL h$(hl,16)
1220 LET x=FN x(h): LET y=FN y(h,x)
1230 LET c1=31
1240 FOR r=0 TO x
1250 FOR c=0 TO c1
1260 IF RND>.2 THEN PRINT AT r,c; INK 1; BRIGHT 0;"\p"
1270 NEXT c
1280 LET c1=c1-y
1285 NEXT r
1290 RETURN
1299 REM bot rough
1300 IF h$(hl,17)="9999" THEN RETURN
1310 LET h=VAL h$(hl,17)
1320 LET x=FN x(h): LET y=FN y(h,x)
1330 LET c1=y
1340 FOR r=x TO 21
1350 FOR c=0 TO c1
1360 IF RND>.2 THEN PRINT AT r,c; INK 1; BRIGHT 0;"\p"
1370 NEXT c
1380 LET c1=c1+y: IF c1>=31 THEN LET c1=31
1385 NEXT r
1390 RETURN
1399 REM trees
1400 IF h$(hl,t1)="9999" THEN RETURN
1410 LET p$="\m"
1415 IF VAL h$(hl,t1)=100 THEN LET p$="\n"
1420 LET h=VAL h$(hl,t2)
1430 LET n1=FN x(h): LET n2=FN y(h,n1)
1440 LET h=VAL h$(hl,t3)
1450 LET m1=FN x(h): LET m2=FN y(h,m1)
1460 FOR n=n1 TO n2: FOR m=m1 TO m2
1470 IF RND>.6 THEN PRINT AT n,m; INK 2;p$
1480 NEXT m: NEXT n
1485 RETURN
1499 REM wind
1500 LET wn=INT (RND*4)+1
1510 IF wn=1 THEN LET wy=-1: LET wx=0
1515 IF wn=2 THEN LET wy=0: LET wx=-1
1520 IF wn=3 THEN LET wy=1: LET wx=0
1525 IF wn=4 THEN LET wy=0: LET wx=1
1529 REM print
1530 PRINT AT 0,0; PAPER 5;" HOLE ";hl;TAB 9;l(hl);" Yds";TAB 17;"PAR ";p(hl);TAB 26;"WIND ";w$(wn)
1540 RETURN
1549 REM lake
1550 IF h$(hl,13)="9999" THEN RETURN
1560 LET h=VAL h$(hl,13)
1570 LET x=FN x(h): LET y=FN y(h,x)
1580 PRINT AT x,y; INK 7; PAPER 5; BRIGHT 1;"\i\s\j";AT x+1,y;"\s\s\s";AT x+2,y; "\s\s\s";AT x+3,y;"\k\s\l"
1590 RETURN
1599 REM stream
1600 IF h$(hl,14)="9999" THEN RETURN
1610 LET h=VAL h$(hl,14)
1620 LET x1=FN x(h): LET y1=FN y(h,x1)
1630 LET h=VAL h$(hl,15)
1640 LET x2=FN x(h): LET y2=FN y(h,x2)
1650 FOR n=x1 TO x2
1660 FOR m=y1 TO y2 STEP -1
1670 IF n+m=x1+y1 THEN PRINT AT n,m; INK 7; PAPER 5; BRIGHT 1;"\s"
1680 NEXT m: NEXT n
1690 RETURN
1999 REM instructions
2000 POKE 23692,255
2005 PRINT AT 1,1;"The round of golf that you will"'" play is as near as possible"'" to a real game. You will be"'" asked to state your handicap"'"(0 to 24) and this will"'" influence the length and"'" accuracy of your shots."''
2010 PRINT " You will carry a normal bag of"'" clubs consisting of :-"
2020 PRINT AT 12,7;"Driver..........1w";AT 13,7;" .........2w";AT 14,7;"Spoon ..........3w";AT 15,7;"1 - 9 irons ....1 - 9";AT 16,7;"wedge...........w";AT 17,7;"sand wedge......sw";AT 18,7;"putter...........p"
2030 PRINT AT 21,1;"(Any key to continue)": PAUSE 0
2040 PRINT '"If you attempt to hit the ball"'" off the screen you will incur"'" 2 penalty strokes for going out"'" of bounds and your ball will"'" be replaced on the edge of"'" the screen. "
2050 PRINT '" If you drive into water you"'" will incur 2 penalty strokes"'" and your ball will be replaced"'" on the tee side of the water."
2060 PRINT ''" For each hole you will be told"'" the yardage, par, direction of"'" wind and number of strokes so"'" far. This information is"'" displayed above and below the"'" plan of the hole."
2070 PRINT 'TAB 1;"(Any key to continue)": PAUSE 0
2080 PRINT '''" The direction of your stroke"'" is entered in terms of a clock"'" face. The strength can be from"'" 30% to 100% of a full swing."'" Information about the result"'" of the previous stroke is shown"'" below the plan of the hole."
2085 PRINT '" At the end of your round you"'" will be shown your card for"'" that round."
2090 PRINT ''''''''AT 21,1;"(Any key to continue)": PAUSE 0: RETURN
2999 REM sand
3000 PRINT AT 21,0; PAPER 6;"Take a sand wedge"
3010 PAUSE 100: GO SUB 7050: GO TO 585
3019 REM trees
3020 LET da=da+(1-INT (RND*3))/10
3049 REM rough
3050 LET l=l-INT (RND*4)
3060 RETURN
3149 REM water
3150 LET yd=by-3: LET xd=bx
3160 LET w1=0
3170 PRINT AT 21,0; PAPER 6;"In water "
3180 LET sc=sc+1
3190 PAUSE 100: GO SUB 7050: GO TO 500
3249 REM hole
3250 PRINT AT 21,0; INK 0; PAPER 5; FLASH 1;"You have holed out in ";sc;" strokes";"( )" AND sc<10
3260 PAUSE 200
3265 LET h(hl)=sc
3270 GO TO 150
3299 REM putt
3300 INPUT "STRENGTH OF PUTT (1 - 3) "; LINE v$
3310 IF v$<"1" OR v$>"3" THEN GO TO 3300
3320 LET wy=0: LET wx=0
3325 LET l=VAL v$
3330 GO TO 400
3349 REM random angle
3350 LET da2=(PI/18)*hc/12
3360 LET da1=da2*(INT (RND*3)-1)
3370 RETURN
3999 REM finish
4000 PAPER 7: INK 0: CLS
4005 LET pt1=0: LET pt2=0: LET ht1=0: LET ht2=0: LET lt1=0: LET lt2=0
4010 PRINT AT 1,7;"SPECTRUM GOLF CLUB";AT 3,5;"LENGTH 6505 YDS PAR 72"
4015 PRINT AT 5,0;" YDS PAR SC YDS PAR SC"
4020 PLOT 3,44: DRAW 0,93: DRAW 249,0: DRAW 0,-93: DRAW -249,0
4025 PLOT 126,44: DRAW 0,93
4030 PLOT 22,44: DRAW 0,93: PLOT 60,44: DRAW 0,93: PLOT 93,44: DRAW 0,93
4035 PLOT 148,44: DRAW 0,93: PLOT 187,44: DRAW 0,93: PLOT 220,44: DRAW 0,93
4040 FOR n=1 TO 9: PRINT AT n+6,1;n;AT n+6,16;n+9: NEXT n
4043 PRINT AT 20,1;n$
4045 FOR n=1 TO 9: LET ht1=ht1+h(n): LET ht2=ht2+h(n+9): LET lt1=lt1+l(n): LET lt2=lt2+l(n+9): LET pt1=pt1+p(n): LET pt2=pt2+p(n+9): PRINT AT n+6,4;l(n);AT n+6,9;p(n);AT n+6,13;h(n);AT n+6,20;l(n+9);AT n+6,25;p(n+9);AT n+6,29;h(n+9): NEXT n
4050 PRINT AT 17,0;"( )";lt1; "( ) ";pt1;"( )";ht1;AT 17,16;"( )";lt2;"( )";pt2;"( )";ht2
4055 PRINT AT 19,18;"TOTAL ";ht1+ht2;AT 20,15;"HANDICAP ";hc;AT 21,19;"NETT ";ht1+ht2-hc
4060 PRINT AT 20,1;n$
6090 STOP
6999 REM out of bounds
7000 PRINT AT 21,0; INK 0; PAPER 5;"Out of Bounds. "
7010 LET ob1=0
7020 LET sc=sc+2
7030 PAUSE 100: GO SUB 7050: RETURN
7049 REM clear bottom line
7050 PRINT AT 21,0; PAPER 5;"( )"
7060 RETURN
7999 REM data
8010 DATA 0401,0326,0427,0110,1219,0100,1820,0031,0100,1313,1216,0728,9999,9999,9999,0200,1606
8020 DATA 1201,0928,0929,0108,1015,0100,1420,1631,0200,1210,1126,0825,9999,9999,9999,1002,1403
8030 DATA 1101,0822,0823,0417,2731,0200,9999,9999,9999,0720,0918,1220,9999,9999,9999,0802,1405
8040 DATA 1801,0426,0527,1321,1131,0100,9999,9999,9999,0330,0524,0530,9999,9999,9999,1402,9999
8050 DATA 0401,1626,1628,0106,0931,0200,0711,1831,0200,1427,1630,1830,9999,9999,9999,0300,0702
8060 DATA 0801,1628,1729,0108,2031,0200,1221,0011,0200,1214,1825,1329,9999,0123,2103,0505,1203
8070 DATA 0201,1426,1428,0112,1031,0100,9999,9999,9999,1411,1508,1730,9999,9999,9999,9999,1610
8080 DATA 1501,0626,0727,0610,0311,0200,1421,2131,0100,0425,0530,1027,1210,9999,9999,1302,1711
8090 DATA 1701,1625,1626,0107,2531,0100,0820,0821,0100,1429,1924,1930,9999,9999,9999,1005,9999
8100 DATA 1001,0927,1028,1421,1931,0200,9999,9999,9999,1024,1325,1116,9999,9999,9999,0700,1304
8110 DATA 1802,0424,0426,0110,0014,0100,1221,1731,0100,0225,0429,0827,9999,9999,9999,9999,9999
8120 DATA 1302,0626,0727,0207,1117,0200,1321,2231,0200,1214,1415,0824,9999,9999,9999,1002,1631
8130 DATA 0302,1525,1626,9999,9999,9999,9999,9999,9999,0713,0911,1829,0922,0130,2011,0200,1931
8140 DATA 1701,1427,1328,1120,1023,0200,0107,2131,0200,0716,0918,1525,9999,9999,9999,1003,1831
8150 DATA 1001,1123,1125,0120,2831,0100,0120,2831,0200,0925,1116,1525,9999,9999,9999,0801,1207
8160 DATA 1002,0926,1027,9999,9999,9999,9999,9999,9999,0728,0930,1229,9999,0130,2011,0701,1311
8170 DATA 1101,0526,0527,0108,0021,0100,1420,0026,0200,1017,1217,0930,9999,9999,9999,0200,9999
8180 DATA 0202,1727,1828,0107,0931,0200,0813,2031,0100,1527,1825,1217,9999,9999,9999,9999,0702
8210 DATA 300,4,1.7
8220 DATA 500,5,1
8230 DATA 250,3,2.2
8240 DATA 400,4,1.5
8250 DATA 200,3,2.5
8260 DATA 350,4,1.4
8270 DATA 420,4,1.45
8280 DATA 480,5,1.15
8290 DATA 280,4,1.75
8300 DATA 330,4,1.6
8310 DATA 160,3,3.2
8320 DATA 450,4,1.3
8330 DATA 495,5,1
8340 DATA 400,4,1.5
8350 DATA 440,4,1.35
8360 DATA 190,3,2.8
8370 DATA 470,5,1.2
8380 DATA 390,4,1.6
8390 DATA 247,255,255,255,255,255,255,255,96,248,254,254,255,127,127,30,3,15,31,63,127,127,255,255,192,240,252,254,254,255,255,255,255,255,255,127,63,31,31,7,255,254,254,254,252,248,224,192,255,255,255,254,255,255,255,255,0,0,24,60,60,24,0,0,3,14,24,17,50,36,109,192,192,32,24,198,34,35,145,73,146,137,72,36,35,16,24,7,73,137,17,34,66,4,28,240,8,8,28,28,62,62,8,8,28,62,127,127,127,62,8,8,255,255,255,255,255,255,255,247,0,82,34,0,0,74,68,0,0,0,24,36,36,24,0,0,8,8,8,8,8,62,28,8,0,48,73,134,0,48,73,134,126,1,57,17,17,17,1,126,255,255,255,255,127,255,255,255
9000 LET i=CODE SCREEN$ (x,y): IF i THEN RETURN
9010 POKE 23606,PEEK 23675: POKE 23607,PEEK 23676-1
9020 LET i=CODE SCREEN$ (x,y)+112
9030 POKE 23606,0: POKE 23607,60: RETURN
9998 SAVE "SPEC-GOLF" LINE 1