GOLF PARTNER stores your golf scores and calculates your average and handicap. The program holds information for 100 rounds of golf, and calculates the statistics after your first ten entries.
Non-golfers–learn programming tricks from GOLF PARTNER. Line 425 clears the screen automatically when the display fills, preventing error report 5 so you don’t need to press CONTinue to go on.
To enter line 0 (not normally accepted on the ZX/TS), enter 1 REM followed by the text. Then type with no line number: POKE 16510,0 and press ENTER. You now have an undeditable line 0.
For your first entry, GOTO 900 to DIMension all arrays and set the first date entry equal to END, teling the computer to start taking information at line 1. The program then returns to the menu, and self-runs after that.
Choose from three options: ENTER NEW DATA, VIEW PAST DATA and SAVE TO TAPE. Press 1 to enter data. (Go directly to this option to add all future entries.) Type in the date, golf course name, number of holes and score as asked. Type END to see the menu again. After ten rounds of golf, press ENTER to see your average and handicap. As you add entries, GOLF PARTNER calculates statistics based on the ten most recent rounds.
Variables
D$=Date array C$=Course name array N=Holes completed array S=Score array Z$=Input (or any choice) O$=Menu selection O=Value of O$ L=Line counter; subscript X=Control variable (handicap) T=Total strokes A=Average score H=Handicap
0 REM --GOLF PARTNER BY JOE GLASS. (C)1983
2 REM
3 REM
4 REM
5 REM
6 REM --GOTO 900 ON FIRST TRY
7 REM
8 REM
9 REM D$=DATE
10 REM C$=COURSE
11 REM N(L)=HOLES COMPLETED
12 REM S(L)=SCORE
18 SLOW
19 GOTO 100
20 REM
21 REM --CLEAR ROUTINE
22 REM
24 CLS
25 PRINT
30 RETURN
37 REM
38 REM --RETURN TO MENU OPTION
39 REM
40 PRINT AT 21,0;"KEY ENTER TO CONTINUE"
45 INPUT X$
50 GOTO 100
57 REM
58 REM --OUTPUT FORMAT ROUTINE
59 REM
60 PRINT TAB 2;"DATE";TAB 11;"COURSE";TAB 21;"HOLES";TAB 27;"SCORE"
65 PRINT TAB 2;"----";TAB 11;"------";TAB 21;"-----";TAB 27;"-----"
70 PRINT
75 RETURN
77 REM
78 REM --START HANDICAP ROUTINE
79 REM
80 PRINT AT 21,0;"KEY ENTER FOR YOUR STATISTICS"
85 INPUT Z$
90 GOTO 700
97 REM
98 REM --MAIN MENU
99 REM
100 GOSUB 20
105 PRINT " GOLF PARTNER T/S 1000 "
110 PRINT AT 7,8;"1 ENTER NEW DATA"
115 PRINT AT 9,8;"2 VIEW PAST DATA"
120 PRINT AT 11,8;"3 SAVE TO TAPE"
125 PRINT AT 17,0;"█████████████████████████████=="
130 PRINT AT 21,0;" OPTION? "
135 INPUT O$
140 IF CODE O$<29 OR CODE O$>31 THEN GOTO 130
141 LET O=VAL O$
145 GOTO O*200
157 REM
158 REM --REPRINTS HEADINGS
159 REM
160 GOSUB 20
165 GOSUB 60
170 RETURN
197 REM
198 REM --ENTER NEW DATA
199 REM
200 GOSUB 20
205 FOR L=1 TO 100
206 IF D$(L,1 TO 3)="END" THEN GOTO 209
207 NEXT L
209 PRINT "LAST ENTRY WAS ON: ";D$(L-1)
210 PRINT "ENTER NEW DATA";TAB 0;"TYPE ""END"" TO STOP"
211 PRINT "▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀"
215 PRINT "ENTER THE DATE (EG. 1/28/51)"
220 INPUT D$(L)
225 IF D$(L,1 TO 3)="END" THEN GOTO 100
230 GOSUB 20
235 PRINT "ENTER COURSE NAME"
236 PRINT "▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀"
240 INPUT C$(L)
245 GOSUB 20
250 PRINT "HOLES COMPLETED (9 OR 18 ONLY)"
255 INPUT N(L)
260 GOSUB 20
265 PRINT "ENTER YOUR SCORE"
270 INPUT S(L)
275 GOSUB 20
280 LET L=L+1
285 IF L>100 THEN GOTO 100
290 GOTO 210
397 REM
398 REM --VIEW PAST DATA
400 GOSUB 20
405 GOSUB 60
410 FOR L=1 TO 100
415 PRINT D$(L);TAB 9;C$(L);TAB 23;N(L);TAB 28;S(L)
420 IF D$(L,1 TO 3)="END" THEN GOTO 80
425 IF PEEK 16442<4 THEN GOSUB 160
430 NEXT L
435 GOTO 40
597 REM
598 REM --SAVE TO TAPE
599 REM
600 GOSUB 20
605 PRINT "ALL DATA WILL BE SAVED IN THE STANDARD T/S 1000 FORMAT... KEY ENTER WHEN READY."
610 INPUT X$
615 SAVE "GOLF"
620 GOTO 100
697 REM
698 REM --HANDICAP FORMULA
699 REM
700 GOSUB 20
705 LET X=1
710 LET T=0
711 REM
712 REM --NEXT TWO LINES ADJUST SCORES TO THEIR 18 HOLE EQUIVALENT.
713 REM
715 IF N(L-X)=18 THEN LET T=T+S(L-X)
716 IF N(L-X)=9 THEN LET T=T+(2*S(L-X))
720 LET X=X+1
725 IF X=11 THEN GOTO 735
730 GOTO 715
735 LET A=T/10
740 LET R=A-72
745 LET H=INT (R*.85)
746 PRINT "BASED ON YOUR LAST TEN ROUNDS:"
747 PRINT
748 PRINT
749 PRINT
750 PRINT "TOTAL STROKES= ";T
755 PRINT "AVERAGE= ";A
760 PRINT
765 PRINT
770 PRINT "YOUR HANDICAP IS ";H
775 GOTO 40
897 REM
898 REM --INITIAL SET-UP
899 REM
900 DIM D$(100,8)
901 DIM C$(100,12)
902 DIM N(100)
903 DIM S(100)
904 LET D$(2)="END"
905 GOTO 100
2000 REM
2001 REM --(C)1983. GLASSWARE.
2004 REM
SYNTACTIC SUM: 33644, 8K ROM

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