Spectrum Golf

This file is part of and Miscellaneous Programs. Download the collection to get this file.
Date: 1982
Type: Program
Platform(s): TS 2068
Tags: Game, Software

This is a one-or-two-player text-mode golf simulation for 9 or 18 holes, where each hole is procedurally generated using RND to place rough, trees, bunkers, water hazards, fairway, green, and the hole itself on the 21×32 character display. Players specify shot direction (0–12, clock-face style) and strength (0–100) each turn; trigonometry via COS and SIN converts these into row/column displacement, with the scaling factor STEP derived from randomly generated yardage. Terrain detection relies entirely on reading back attribute values with ATTR: each terrain type carries a distinct ink/paper colour combination (e.g. attribute 36 = fairway, 32 = rough, 4 = trees, 48 = bunker, 100 = green, 41 = water), so no separate map array is needed. Five UDGs (A–E) are defined at startup via POKEs into USR memory using DATA statements to represent rough texture, trees, water, the hole flag, and the ball. The error-handler at line 1130 uses the TS2068 ON ERR keywords to catch runtime errors, then triggers an auto-save loop at line 1170 that repeatedly SAVEs the program to tape before restarting.


Program Structure

The program is organised into clearly separated subroutines and a linear main flow:

  1. Lines 10–130: Entry point redirects to 140; subroutine at 20–130 generates one hole (course drawing + par/yardage setup).
  2. Lines 140–250: Initialisation — border/paper, UDG loading, instructions prompt, course length and player count selection.
  3. Lines 260–600: Main game loop — for each hole, for each stroke, for each player.
  4. Lines 610–790: Score card display after each hole.
  5. Lines 800–830: End-of-game prompt.
  6. Lines 840–920: Input subroutine — waits for ENTER, collects direction and strength.
  7. Lines 930–960: Water hazard handler.
  8. Lines 970–1010: UDG DATA (5 characters × 8 bytes).
  9. Lines 1020–1120: Instructions subroutine.
  10. Lines 1130–1170: Global error handler with auto-save loop.

Course Generation

Each hole is drawn entirely with PRINT AT statements inside subroutine 20. The terrain layers are applied in order:

  • Line 20: Fills the screen with UDG \a (rough) using PAPER 7 — 44 iterations of 16 UDGs each cover the 21-row display.
  • Line 30: Draws 3–6 tree columns (UDG \b) wandering down the screen with a random walk on column K.
  • Line 40: Cuts fairway strips (two-space-wide, PAPER 4 implied by colour) at odd columns 1–29.
  • Line 50: Adds a water hazard patch (UDG \c) with a random walk.
  • Line 60: Places 2–4 bunker patches (spaces with distinct colour) near columns 21–27.
  • Lines 70–80: Places the green (blank rectangle) and the hole flag (UDG \d) in the right portion of the screen.
  • Line 90: Sets the ball start position BX (row 5–13), BY=0 (left edge).

Crucially, no terrain array is stored. The colour attribute of each screen cell encodes terrain type; the game reads it back with ATTR(row,col) at line 450.

Attribute-Based Terrain Detection

Each terrain type is identified by its attribute byte value:

ATTR valueTerrainEffect on shot
36FairwayFull distance
32Rough (UDG \a)Distance halved to quartered
4Trees (UDG \b)40% chance ball bounces random direction, distance quartered
48Bunker40% chance shot distance zeroed (miss-hit)
100GreenFull distance, no modifier
41WaterPenalty stroke; ball walked back along row to dry land
97Holed outPlayer skipped in subsequent strokes
39Other player’s ball cellBorrows that player’s terrain attribute
1Tee positionRestored to “T” when ball leaves

Shot Physics

Direction is entered as a clock-face value 0–12. The constant V = PI/6 (line 250) converts clock hours to radians (one hour = 30°). Row displacement uses -ST*COS(D*V) (decreasing row = upward on screen) and column displacement uses +ST*SIN(D*V). The raw strength ST is scaled by STEP*2 where STEP = 28/YRD, so longer holes have smaller per-unit movement, giving the yardage figure genuine gameplay meaning.

Player State Array

All player state is held in a 2D array P(PL, 6) dimensioned at line 250. The columns are used as:

IndexContents
P(I,1)Current row (ball position)
P(I,2)Current column
P(I,3) — accessed as P(I,PI)Current terrain attribute (PI≈3, rounded to 3)
P(I,4)Cumulative course score (strokes vs par total)
P(I,5)Score for current hole vs par
P(I,6)Penalty stroke count for current hole

Using PI (≈3.14159, truncated to integer index 3) as an array subscript is an intentional trick to store the terrain attribute in column 3 without using a literal digit — it saves one byte per reference in the tokenised file.

UDG Definition

Lines 160 and 970–1010 define five UDGs A–E using a nested FOR loop and READ/POKE. The loop iterates I from 65 (‘A’) to 69 (‘E’) and POKEs 8 bytes each into USR CHR$ I. The five characters represent: \a = rough texture, \b = tree, \c = water, \d = hole/flag, \e = ball marker. The ball UDG \e is printed in flashing mode at the player’s position to indicate whose turn it is (lines 850/870 toggle it by printing it twice — since it’s flashing, the second print re-draws it in the same state, effectively just confirming position).

Status Bar Technique

The string B$ is built at line 170 as CHR$ 22 + CHR$ 21 + CHR$ 0 + (32 spaces) + (same prefix again). CHR$ 22 is the AT control code; CHR$ 21 and CHR$ 0 position output at row 21, column 0. The 32 spaces clear the bottom line, and the second prefix repositions the cursor ready for the following message. This gives a single-line status bar at the bottom of the play area without using CLS.

Error Handling and Auto-Save

The TS2068-specific ON ERR keyword is used in three ways. Line 100 traps errors during course generation to jump to the error handler. Lines 1130–1160 implement a three-stage recovery: ON ERR RESET clears the error condition, then ON ERR CONTINUE resumes, and line 1170 enters an infinite SAVE "golf" LINE 140: GO TO 1170 loop, repeatedly offering the program to tape until the user intervenes. Line 20 also uses ON ERR GO TO 20 inside the rough-drawing loop, which silently retries if a PRINT AT goes out of range.

Water Hazard Recovery Bug

Lines 940–950 attempt to walk the ball leftward (decreasing column) to find dry land after a water landing. The loop walks I from INT(P(P,2)) down to 0; the condition at 950 reads IF ATTR(P(P,1),I)=41 THEN NEXT I, meaning it continues iterating while the cell IS water and exits the loop when it finds non-water or reaches column 0. However, if column 0 is also water the loop exits at 0 regardless, potentially leaving the ball in water. Additionally, the loop does not protect against the ball’s row being out of the 0–20 display range, which could cause an error caught by the ON ERR handler.

Notable BASIC Idioms

  • Boolean arithmetic for branching-free assignment: LET PAR=3+(J>.5)+(J>=.8) and LET CL=9*(INKEY$="S")+18*(INKEY$="L").
  • String slicing for variable-length UDG runs: "\b\b\b\b\b\b\b\b\b"( TO 4+RND*8) prints a random-length string of tree UDGs in one PRINT statement.
  • PAUSE VAL "200" at line 580 — VAL "200" evaluates to the numeric literal 200; used here as a minor code-size optimisation.
  • The NOT PI idiom at line 150 evaluates to 0 (since PI is non-zero), used to reset BRIGHT, OVER, FLASH, and INK to their default state in one compact chain.

Content

Related Products

Related Articles

Related Content

Image Gallery

Source Code

    0 REM Spectrum "GOLF" 
    0 REM   © R & R SOFTWARE 1982. 
   10 GO TO 140
   20 BORDER 4: PAPER 4: CLS : PAPER 7: FOR I=1 TO 44: PRINT "\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a";: ON ERR GO TO 20: NEXT I
   30 FOR I=1 TO PI+RND*PI: LET K=4+RND*17: FOR L=0 TO 20: LET K=K-2+RND*4: PRINT AT L,K*(K<=31);"\b\b\b\b\b\b\b\b\b"( TO 4+RND*8): NEXT L: NEXT I
   40 FOR I=1 TO 29 STEP 2: LET J=5+RND*5: FOR L=J TO 11+RND*4: PRINT AT L,I;"  ": NEXT L: NEXT I
   50 LET I=5+10*RND: LET J=10+10*RND: FOR L=I TO I+2+RND*2: LET J=J-2+RND*4: PRINT AT L,J;"\c\c\c\c\c\c"( TO 6+RND*3): NEXT L
   60 FOR I=1 TO 2+RND*2: LET J=5+RND*10: LET K=21+RND*6: FOR L=J TO J+1+RND*2: LET K=K-1+RND*2: PRINT AT L,K;"     "( TO 3+RND*2): NEXT L: NEXT I
   70 LET J=INT (4+RND*14): FOR I=J-2 TO J+2: PRINT AT I,25+RND*2;"     ": NEXT I
   80 PRINT AT J,27+RND*PI;"\d "
   90 LET BX=5+RND*8: LET BY=0
  100 ON ERR GO TO 1130
  110 LET J=RND: LET PAR=3+(J>.5)+(J>=.8): LET YRD=(170+INT (RND*100))*(PAR=3)+(275+INT (RND*175))*(PAR=4)+(450+INT (RND*125))*(PAR=5): LET STEP=28/YRD
  120 PRINT AT 1,1;"Hole  ";H;TAB 10;AT 2,1;"Par   ";PAR;TAB 10;AT PI,1;"Yards ";YRD
  130 RETURN 
  140 ON ERR GO TO 1130
  150 BORDER 6: PAPER 6: BRIGHT NOT PI: OVER NOT PI: FLASH NOT PI: INK NOT PI: CLS : RANDOMIZE : POKE 23658,8: RESTORE 
  160 FOR I=65 TO 69: FOR J=0 TO 7: READ X: POKE USR CHR$ I+J,X: NEXT J: NEXT I
  170 LET B$=CHR$ 22+CHR$ 21+CHR$ 0: LET B$=B$+"                                "+B$
  180 PRINT '''''''''"   Do you need instructions?"''TAB 10;"""Y"" OR ""N"""
  190 IF INKEY$="Y" THEN GO SUB 1020: GO TO 210
  200 IF INKEY$<>"N" THEN GO TO 190
  210 CLS : PRINT '''''''"What length of course would you";TAB 10;"like to play?"''TAB 7;"""S""  Short 9 hole."''TAB 7;"""L""  Long 18 hole."
  220 LET CL=9*(INKEY$="S")+18*(INKEY$="L"): IF NOT CL THEN GO TO 220
  230 CLS : PRINT '''''"WELCOME TO THE TS INTERNATIONAL"''TAB 5;CL;" HOLE GOLF COURSE."'''TAB 7;"How many players?";''TAB 10;"""1"" OR ""2"""
  240 LET PL=1*(INKEY$="1")+2*(INKEY$="2"): IF NOT PL THEN GO TO 240
  250 DIM P(PL,6): LET V=PI/6
  260 FOR H=1 TO CL: GO SUB 20
  270 FOR I=1 TO PL: LET P(I,1)=BX: LET P(I,2)=BY: LET P(I,PI)=1: LET P(I,6)=0: NEXT I
  280 LET HO=0: FOR S=1 TO 99: FOR P=1 TO PL
  290 IF P(P,PI)=97 THEN GO TO 580
  300 GO SUB 840: LET ST=ST*STEP*2: LET P$=" "
  310 IF P(P,PI)=32 THEN LET ST=ST/(2+RND*2): LET P$="\a"
  320 IF P(P,PI)=4 THEN LET P$="\b": IF RND>.6 THEN PRINT B$;"YOUR BALL REBOUNDS FROM A TREE.": LET D=RND*12: LET ST=ST/4: PAUSE 150
  330 IF P(P,PI)=48 THEN LET P$=" ": IF RND>.6 THEN PRINT B$;"MISS HIT! You remain in bunker.": LET ST=0: PAUSE 150
  340 IF P(P,PI)=36 THEN LET P$=" "
  350 IF P(P,PI)=100 THEN LET P$=" "
  360 IF P(P,PI)=1 THEN LET P$="T"
  370 PRINT AT P(P,1),P(P,2);P$
  380 LET P(P,1)=P(P,1)-ST*COS (D*V): LET P(P,2)=P(P,2)+ST*SIN (D*V)
  390 IF P(P,1)>=0 AND P(P,1)<=20 AND P(P,2)>=0 AND P(P,2)<=31 THEN GO TO 450
  400 PRINT B$;"OUT OF BOUNDS... PENALTY STROKE": PAUSE 150: LET P(P,6)=P(P,6)+1
  410 IF P(P,1)<0 THEN LET P(P,1)=0
  420 IF P(P,1)>20 THEN LET P(P,1)=20
  430 IF P(P,2)<0 THEN LET P(P,2)=0
  440 IF P(P,2)>31 THEN LET P(P,2)=31
  450 LET P(P,PI)=ATTR (P(P,1),P(P,2))
  460 IF P(P,PI)=39 THEN LET P(P,PI)=P(1+(P=1),PI)
  470 IF P(P,PI)=41 THEN GO TO 930
  480 IF P(P,PI)=97 THEN GO TO 560
  490 PRINT B$;
  500 IF P(P,PI)=36 THEN PRINT "ON THE FAIRWAY"
  510 IF P(P,PI)=32 THEN PRINT "IN THE ROUGH"
  520 IF P(P,PI)=4 THEN PRINT "IN THE TREES..."
  530 IF P(P,PI)=48 THEN PRINT "IN A BUNKER."
  540 IF P(P,PI)=100 THEN PRINT "ON THE GREEN."
  550 PRINT AT P(P,1),P(P,2);"\e": PAUSE 150: PRINT AT P(P,1),P(P,2);"\e": GO TO 580
  560 LET P(P,5)=S+P(P,6)-PAR: LET P(P,4)=P(P,4)+P(P,5): LET HO=HO+1
  570 PRINT B$;"Player ";P;" Holed out in ";S+P(P,6): IF S+P(P,6)=1 THEN FOR I=1 TO 30: BEEP .08,10+RND*20: NEXT I: PRINT B$;"YOU BUY THE DRINKS AT THE 19th."
  580 PAUSE VAL "200": NEXT P
  590 IF HO=PL THEN GO TO 610
  600 NEXT S: REM RESET  R&R SOFTWARE
  610 BORDER 4: PAPER 5: CLS : PRINT " SCORE    TS 2000 GOLF     CARD "
  620 PRINT 'TAB 9+1*(CL=9);CL;" HOLE COURSE"
  630 PRINT '"Hole - ";H;"  Par - ";PAR;"  Yards - ";YRD
  640 PRINT '"PLAYER";TAB 10;"HOLE";TAB 20;"COURSE": PRINT "▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀"
  650 FOR I=1 TO PL: PRINT '"   ";I;TAB 7;
  660 IF NOT P(I,5) THEN PRINT "  On";: GO TO 700
  670 PRINT ABS P(I,5);
  680 IF P(I,5)<0 THEN PRINT " Under";
  690 IF P(I,5)>0 THEN PRINT " Over";
  700 PRINT " Par";TAB 19;
  710 IF NOT P(I,4) THEN PRINT " On";: GO TO 750
  720 PRINT ABS P(I,4);
  730 IF P(I,4)<0 THEN PRINT " Under";
  740 IF P(I,4)>0 THEN PRINT " Over";
  750 PRINT " Par": NEXT I
  760 IF H=CL THEN GO TO 800
  770 PRINT B$;" PRESS ENTER TO START NEXT HOLE "
  780 IF INKEY$<>CHR$ 13 THEN GO TO 780
  790 NEXT H: REM RESET  R&R SOFTWARE
  800 PRINT AT 16,2;"Would you like another game?";AT 18,11;"""Y"" OR ""N"""
  810 IF INKEY$="Y" THEN RUN 140
  820 IF INKEY$="N" THEN PRINT AT 20,7;"Thanks for playing": STOP 
  830 GO TO 810
  840 PRINT B$;"  Player ";P;" Press ENTER to play"
  850 PRINT AT P(P,1),P(P,2);"\e"
  860 IF INKEY$<>CHR$ 13 THEN GO TO 860
  870 PRINT AT P(P,1),P(P,2);"\e"
  880 PRINT B$;"Direction? 0-12": INPUT D: IF D<0 OR D>12 THEN PRINT B$;"INVALID Direction MUST be 0-12": PAUSE 150: GO TO 880
  890 LET D=INT (D*100+.5)/100
  900 PRINT B$;"Direction= ";D;" Strength? 0-100": INPUT ST: IF NOT ST THEN GO TO 880
  910 IF ST<0 OR ST>100 THEN PRINT B$;"INVALID Strength MUST be 0-100": PAUSE 150: GO TO 900
  920 LET ST=INT (ST*100+.5)/100: PRINT B$;"Direction= ";D;" Strength= ";ST: PAUSE 100: RETURN 
  930 PRINT B$;"LANDED IN WATER. Penalty Stroke"
  940 FOR I=INT (P(P,2)) TO 0 STEP -1
  950 IF ATTR (P(P,1),I)=41 THEN NEXT I
  960 LET P(P,2)=I: LET P(P,6)=P(P,6)+1: PAUSE 150: GO TO 450
  970 DATA 0,0,4,0,0,64,0,0
  980 DATA 255,247,227,213,247,227,213,247
  990 DATA 0,96,144,9,102,144,9,6
 1000 DATA 12,60,12,4,4,30,37,30
 1010 DATA 0,28,62,62,62,28,0,0
 1020 BORDER 7: PAPER 7: CLS : LET T$="      TS 2000  PRO-AM GOLF      ": PRINT T$''"   A GAME FOR 1 OR 2 PLAYERS"
 1030 PRINT '" You may play a 9 hole course ORa full 18 hole course. Each holeis generated at RANDOM so no twogames are the same."
 1040 PRINT '" When its your turn to play yourball will be set flashing. When ready for move,Press the ENTER  key. You must now enter a value (0-12, As on a Clock) to select your DIRECTION. Now give a valuefor STRENGTH of shot (1-100), anentry of ZERO will return you tothe direction input.    Decimal inputs ie. 3.25 are allowed."
 1050 PRINT B$;"Hit ENTER for more instructions."
 1060 IF INKEY$<>CHR$ 13 THEN GO TO 1060
 1070 CLS : PRINT T$''"The GREEN =      FAIRWAY =        ROUGH = \a\a\a  BUNKER =    ","WATER HAZZARD = \c\c\c  TREES = \b","  The HOLE = \d   The BALL = \e"
 1080 PRINT '"When playing from the ROUGH yourball will not move as far as it will on the FAIRWAY. If you landin a bunker you may not get out first shot.   When in the TREES the ball MAY bounce off in any  direction.  Land in the WATER orgo OUT OF BOUNDS and you incur  ONE penalty stroke."
 1090 PRINT '"   I hope you enjoy your game  "''"Press ENTER to start round OR   ""P"" to see instructions again."
 1100 IF INKEY$="P" THEN GO TO 1020
 1110 IF INKEY$<>CHR$ 13 THEN GO TO 1100
 1120 RETURN 
 1130 ON ERR RESET 
 1140 PAUSE 100
 1150 ON ERR GO TO 1130
 1160 ON ERR CONTINUE 
 1170 SAVE "golf" LINE 140: GO TO 1170
    0 REM Spectrum "GOLF" 
    0 REM   © R & R SOFTWARE 1982. 
   10 GO TO 140
   20 BORDER 4: PAPER 4: CLS : PAPER 7: FOR I=1 TO 44: PRINT "\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a";: ON ERR GO TO 20: NEXT I
   30 FOR I=1 TO PI+RND*PI: LET K=4+RND*17: FOR L=0 TO 20: LET K=K-2+RND*4: PRINT AT L,K*(K<=31);"\b\b\b\b\b\b\b\b\b"( TO 4+RND*8): NEXT L: NEXT I
   40 FOR I=1 TO 29 STEP 2: LET J=5+RND*5: FOR L=J TO 11+RND*4: PRINT AT L,I;"  ": NEXT L: NEXT I
   50 LET I=5+10*RND: LET J=10+10*RND: FOR L=I TO I+2+RND*2: LET J=J-2+RND*4: PRINT AT L,J;"\c\c\c\c\c\c"( TO 6+RND*3): NEXT L
   60 FOR I=1 TO 2+RND*2: LET J=5+RND*10: LET K=21+RND*6: FOR L=J TO J+1+RND*2: LET K=K-1+RND*2: PRINT AT L,K;"     "( TO 3+RND*2): NEXT L: NEXT I
   70 LET J=INT (4+RND*14): FOR I=J-2 TO J+2: PRINT AT I,25+RND*2;"     ": NEXT I
   80 PRINT AT J,27+RND*PI;"\d "
   90 LET BX=5+RND*8: LET BY=0
  100 ON ERR GO TO 1130
  110 LET J=RND: LET PAR=3+(J>.5)+(J>=.8): LET YRD=(170+INT (RND*100))*(PAR=3)+(275+INT (RND*175))*(PAR=4)+(450+INT (RND*125))*(PAR=5): LET STEP=28/YRD
  120 PRINT AT 1,1;"Hole  ";H;TAB 10;AT 2,1;"Par   ";PAR;TAB 10;AT PI,1;"Yards ";YRD
  130 RETURN 
  140 ON ERR GO TO 1130
  150 BORDER 6: PAPER 6: BRIGHT NOT PI: OVER NOT PI: FLASH NOT PI: INK NOT PI: CLS : RANDOMIZE : POKE 23658,8: RESTORE 
  160 FOR I=65 TO 69: FOR J=0 TO 7: READ X: POKE USR CHR$ I+J,X: NEXT J: NEXT I
  170 LET B$=CHR$ 22+CHR$ 21+CHR$ 0: LET B$=B$+"                                "+B$
  180 PRINT '''''''''"   Do you need instructions?"''TAB 10;"""Y"" OR ""N"""
  190 IF INKEY$="Y" THEN GO SUB 1020: GO TO 210
  200 IF INKEY$<>"N" THEN GO TO 190
  210 CLS : PRINT '''''''"What length of course would you";TAB 10;"like to play?"''TAB 7;"""S""  Short 9 hole."''TAB 7;"""L""  Long 18 hole."
  220 LET CL=9*(INKEY$="S")+18*(INKEY$="L"): IF NOT CL THEN GO TO 220
  230 CLS : PRINT '''''"WELCOME TO THE TS INTERNATIONAL"''TAB 5;CL;" HOLE GOLF COURSE."'''TAB 7;"How many players?";''TAB 10;"""1"" OR ""2"""
  240 LET PL=1*(INKEY$="1")+2*(INKEY$="2"): IF NOT PL THEN GO TO 240
  250 DIM P(PL,6): LET V=PI/6
  260 FOR H=1 TO CL: GO SUB 20
  270 FOR I=1 TO PL: LET P(I,1)=BX: LET P(I,2)=BY: LET P(I,PI)=1: LET P(I,6)=0: NEXT I
  280 LET HO=0: FOR S=1 TO 99: FOR P=1 TO PL
  290 IF P(P,PI)=97 THEN GO TO 580
  300 GO SUB 840: LET ST=ST*STEP*2: LET P$=" "
  310 IF P(P,PI)=32 THEN LET ST=ST/(2+RND*2): LET P$="\a"
  320 IF P(P,PI)=4 THEN LET P$="\b": IF RND>.6 THEN PRINT B$;"YOUR BALL REBOUNDS FROM A TREE.": LET D=RND*12: LET ST=ST/4: PAUSE 150
  330 IF P(P,PI)=48 THEN LET P$=" ": IF RND>.6 THEN PRINT B$;"MISS HIT! You remain in bunker.": LET ST=0: PAUSE 150
  340 IF P(P,PI)=36 THEN LET P$=" "
  350 IF P(P,PI)=100 THEN LET P$=" "
  360 IF P(P,PI)=1 THEN LET P$="T"
  370 PRINT AT P(P,1),P(P,2);P$
  380 LET P(P,1)=P(P,1)-ST*COS (D*V): LET P(P,2)=P(P,2)+ST*SIN (D*V)
  390 IF P(P,1)>=0 AND P(P,1)<=20 AND P(P,2)>=0 AND P(P,2)<=31 THEN GO TO 450
  400 PRINT B$;"OUT OF BOUNDS... PENALTY STROKE": PAUSE 150: LET P(P,6)=P(P,6)+1
  410 IF P(P,1)<0 THEN LET P(P,1)=0
  420 IF P(P,1)>20 THEN LET P(P,1)=20
  430 IF P(P,2)<0 THEN LET P(P,2)=0
  440 IF P(P,2)>31 THEN LET P(P,2)=31
  450 LET P(P,PI)=ATTR (P(P,1),P(P,2))
  460 IF P(P,PI)=39 THEN LET P(P,PI)=P(1+(P=1),PI)
  470 IF P(P,PI)=41 THEN GO TO 930
  480 IF P(P,PI)=97 THEN GO TO 560
  490 PRINT B$;
  500 IF P(P,PI)=36 THEN PRINT "ON THE FAIRWAY"
  510 IF P(P,PI)=32 THEN PRINT "IN THE ROUGH"
  520 IF P(P,PI)=4 THEN PRINT "IN THE TREES..."
  530 IF P(P,PI)=48 THEN PRINT "IN A BUNKER."
  540 IF P(P,PI)=100 THEN PRINT "ON THE GREEN."
  550 PRINT AT P(P,1),P(P,2);"\e": PAUSE 150: PRINT AT P(P,1),P(P,2);"\e": GO TO 580
  560 LET P(P,5)=S+P(P,6)-PAR: LET P(P,4)=P(P,4)+P(P,5): LET HO=HO+1
  570 PRINT B$;"Player ";P;" Holed out in ";S+P(P,6): IF S+P(P,6)=1 THEN FOR I=1 TO 30: BEEP .08,10+RND*20: NEXT I: PRINT B$;"YOU BUY THE DRINKS AT THE 19th."
  580 PAUSE VAL "200": NEXT P
  590 IF HO=PL THEN GO TO 610
  600 NEXT S: REM RESET  R&R SOFTWARE
  610 BORDER 4: PAPER 5: CLS : PRINT " SCORE    TS 2000 GOLF     CARD "
  620 PRINT 'TAB 9+1*(CL=9);CL;" HOLE COURSE"
  630 PRINT '"Hole - ";H;"  Par - ";PAR;"  Yards - ";YRD
  640 PRINT '"PLAYER";TAB 10;"HOLE";TAB 20;"COURSE": PRINT "▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀"
  650 FOR I=1 TO PL: PRINT '"   ";I;TAB 7;
  660 IF NOT P(I,5) THEN PRINT "  On";: GO TO 700
  670 PRINT ABS P(I,5);
  680 IF P(I,5)<0 THEN PRINT " Under";
  690 IF P(I,5)>0 THEN PRINT " Over";
  700 PRINT " Par";TAB 19;
  710 IF NOT P(I,4) THEN PRINT " On";: GO TO 750
  720 PRINT ABS P(I,4);
  730 IF P(I,4)<0 THEN PRINT " Under";
  740 IF P(I,4)>0 THEN PRINT " Over";
  750 PRINT " Par": NEXT I
  760 IF H=CL THEN GO TO 800
  770 PRINT B$;" PRESS ENTER TO START NEXT HOLE "
  780 IF INKEY$<>CHR$ 13 THEN GO TO 780
  790 NEXT H: REM RESET  R&R SOFTWARE
  800 PRINT AT 16,2;"Would you like another game?";AT 18,11;"""Y"" OR ""N"""
  810 IF INKEY$="Y" THEN RUN 140
  820 IF INKEY$="N" THEN PRINT AT 20,7;"Thanks for playing": STOP 
  830 GO TO 810
  840 PRINT B$;"  Player ";P;" Press ENTER to play"
  850 PRINT AT P(P,1),P(P,2);"\e"
  860 IF INKEY$<>CHR$ 13 THEN GO TO 860
  870 PRINT AT P(P,1),P(P,2);"\e"
  880 PRINT B$;"Direction? 0-12": INPUT D: IF D<0 OR D>12 THEN PRINT B$;"INVALID Direction MUST be 0-12": PAUSE 150: GO TO 880
  890 LET D=INT (D*100+.5)/100
  900 PRINT B$;"Direction= ";D;" Strength? 0-100": INPUT ST: IF NOT ST THEN GO TO 880
  910 IF ST<0 OR ST>100 THEN PRINT B$;"INVALID Strength MUST be 0-100": PAUSE 150: GO TO 900
  920 LET ST=INT (ST*100+.5)/100: PRINT B$;"Direction= ";D;" Strength= ";ST: PAUSE 100: RETURN 
  930 PRINT B$;"LANDED IN WATER. Penalty Stroke"
  940 FOR I=INT (P(P,2)) TO 0 STEP -1
  950 IF ATTR (P(P,1),I)=41 THEN NEXT I
  960 LET P(P,2)=I: LET P(P,6)=P(P,6)+1: PAUSE 150: GO TO 450
  970 DATA 0,0,4,0,0,64,0,0
  980 DATA 255,247,227,213,247,227,213,247
  990 DATA 0,96,144,9,102,144,9,6
 1000 DATA 12,60,12,4,4,30,37,30
 1010 DATA 0,28,62,62,62,28,0,0
 1020 BORDER 7: PAPER 7: CLS : LET T$="      TS 2000  PRO-AM GOLF      ": PRINT T$''"   A GAME FOR 1 OR 2 PLAYERS"
 1030 PRINT '" You may play a 9 hole course ORa full 18 hole course. Each holeis generated at RANDOM so no twogames are the same."
 1040 PRINT '" When its your turn to play yourball will be set flashing. When ready for move,Press the ENTER  key. You must now enter a value (0-12, As on a Clock) to select your DIRECTION. Now give a valuefor STRENGTH of shot (1-100), anentry of ZERO will return you tothe direction input.    Decimal inputs ie. 3.25 are allowed."
 1050 PRINT B$;"Hit ENTER for more instructions."
 1060 IF INKEY$<>CHR$ 13 THEN GO TO 1060
 1070 CLS : PRINT T$''"The GREEN =      FAIRWAY =        ROUGH = \a\a\a  BUNKER =    ","WATER HAZZARD = \c\c\c  TREES = \b","  The HOLE = \d   The BALL = \e"
 1080 PRINT '"When playing from the ROUGH yourball will not move as far as it will on the FAIRWAY. If you landin a bunker you may not get out first shot.   When in the TREES the ball MAY bounce off in any  direction.  Land in the WATER orgo OUT OF BOUNDS and you incur  ONE penalty stroke."
 1090 PRINT '"   I hope you enjoy your game  "''"Press ENTER to start round OR   ""P"" to see instructions again."
 1100 IF INKEY$="P" THEN GO TO 1020
 1110 IF INKEY$<>CHR$ 13 THEN GO TO 1100
 1120 RETURN 
 1130 ON ERR RESET 
 1140 PAUSE 100
 1150 ON ERR GO TO 1130
 1160 ON ERR CONTINUE 
 1170 SAVE "golf" LINE 140: GO TO 1170

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top