10000 '************************************************************* 10002 '***** PC-GOLF THE GOLFER's PROGRAM PC-GOLF ***** 10004 '***** Version 1.3 (C) 1982,1983,1984 Ed Chandler ***** 10006 '************************************************************* 10018 ' 2. TALLY THE SCORES FOR A ROUND 10020 '+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 10030 MNU5$="PC-GOLF's Scorekeeper" 10040 CLS:PRINT MNU2$:PRINT:PRINT MNU5$:PRINT 10042 IF ROS=0 THEN 10060 10050 DEF SEG=&H40:I%=PEEK(&H17):I%=I% OR 32:POKE &H17,I% 'num lock on 10060 IF PACT>0 THEN 10100 10070 PRINT:PRINT"The player roster is empty. To Tally" 10080 PRINT"scores you must first add a player" 10090 PRINT"to the player roster.":GOSUB 580:GOTO 530 'back to main 10100 MNU1$="1. Tally the player's scores only.":PRINT SPC(3);MNU1$ 10110 MNU3$="2. Tally the player's putts only.":PRINT SPC(3);MNU3$ 10120 MNU4$="3. Tally both the player's putts and scores.":PRINT SPC(3);MNU4$ 10130 PRINT SPC(3);MNURT$:PRINT 10140 M1$="key":M2$="(1,2,3 or M) ":GOSUB 570 10150 IF KB=1 THEN MNU6$=MNU1$:YT=1:GOTO 10200 10160 IF KB=2 THEN MNU6$=MNU3$:YT=2:GOTO 10200 10170 IF KB=3 THEN MNU6$=MNU4$:YT=3:GOTO 10200 10180 IF KB$="M" OR KB$="m" THEN CLOSE:GOTO 530 'back to main 10190 GOSUB 610:GOTO 10040 'menu 10200 CLS:PRINT MNU5$:X=1:GOSUB 550 'show roster 10210 PRINT:IF PR=0 THEN GOSUB 590:GOTO 530 'back to main 10220 LINE INPUT"ENTER the line number of the player you want to tally. ";KB$ 10230 KB=VAL(KB$):IF KB>0 AND KB<=PMAX AND TMP(KB)=KB THEN 10260 10240 GOSUB 611:GOTO 10200 10250 '+++++ 10260 PRN=KB:GOSUB 660:GET #4,KB 'get players record 10270 RN=VAL(E4$):N$=MID$(GCDIR$(RN),3,NMAX):IF INSTR(N$,"*")=0 THEN 10320 10280 PRINT:PRINT"The player has not been assigned a home course. You must" 10290 PRINT"assign a home course before scores can be tallied." 10300 CLOSE #4:GOSUB 580:GOTO 530 'back to main 10310 '+++++ 10320 HC=1:T$="White":IF G4$="g" THEN T$="Gold" 10330 IF G4$="b" THEN T$="Blue" ELSE IF G4$="r" THEN T$="Red" 10340 GOSUB 670:GET #5,KB 'get player.dat 10350 CLS:PRINT MNU5$:PRINT:PRINT MNU6$:PRINT 10360 COLOR 0,15,0:PRINT SPC(7);B4$:COLOR 7,0,0 10370 PRINT:PRINT "Do you want to TALLY scores for:" 10380 ' 10390 PRINT"a round played at," 10400 PRINT:COLOR 0,15,0:PRINT SPC(7);N$:COLOR 7,0,0 10410 PRINT:PRINT"using the ";:COLOR 0,15,0:PRINT SPC(2)T$SPC(2); 10420 COLOR 7,0,0:PRINT" tees?" 10430 RESTORE 834:GOSUB 600:IF KB$="Y" THEN 10700 ' ok-go 10440 '+++++ get preferred course +++++ 10450 CLS:PRINT MNU5$:M1=0:GOSUB 540 'show courses 10460 PRINT:PRINT"PRESS the line number of the course" 10470 PRINT:M1$="where this round was played. ":GOSUB 560 10480 IF KB>0 AND KB<=CMAX AND TMP(KB)=KB THEN 10510 10490 PRINT:PRINT"Please choose a line number from the list." 10500 GOSUB 580:GOTO 10450 10510 HC=1:RN=KB:IF RN=VAL(E4$) THEN 10550 10520 HC=0:PRINT:PRINT"This is not the player's home course.":BEEP 10530 RN=KB:RESTORE 813:GOSUB 600 10540 IF KB$<>"Y" THEN 10450 10550 GOSUB 650:GOSUB 655:GET #2,RN:GET #3,RN:CLOSE #2,#3 'get course records 10560 P$=E2$:IF F4$="f" THEN P$=H2$ 10570 GOSUB 710 'set up CP(I)=course pars 10580 CLS:PRINT:PRINT MNU5$:PRINT:T=1 10590 IF CVS(K2$)<>0 THEN PRINT USING" #. GOLD"; T:T$(T)="Gold":A$(T)=K2$:T=T+1 10600 IF CVS(L2$)<>0 THEN PRINT USING" #. BLUE"; T:T$(T)="Blue":A$(T)=L2$:T=T+1 10610 IF CVS(F2$)<>0 THEN PRINT USING" #. WHITE";T:T$(T)="White":A$(T)=F2$:T=T+1 10620 IF CVS(I2$)<>0 THEN PRINT USING" #. RED"; T:T$(T)="Red" :A$(T)=I2$:T=T+1 10630 PRINT:PRINT"PRESS the line number for the Tees" 10640 M1$="the player used for this round. ":GOSUB 560 10650 T=T-1:IF KB<1 OR KB>T THEN GOSUB 610:GOTO 10580 10660 T$=T$(KB) 'cr name 10670 CR!=CVS(A$(KB)) 'CR for this course 10680 N$=MID$(GCDIR$(RN),3,NMAX):GOTO 10350 10690 '+++++ get course records 10700 GOSUB 650:GOSUB 655:GET #2,RN:GET #3,RN:CLOSE #2,#3 10710 P$=E2$:IF F4$="f" THEN P$=H2$ 10720 GOSUB 710 'set CP(I)=pars 10730 IF YT=1 OR YT=3 THEN 10810 'tally scores 10740 '+++++ 10750 IF YT=2 OR YT=3 THEN 12250 'tally putts 10760 'nop 10770 '+++++ SAVE SCORES AND PUTTS +++++ 10780 PUT #5,PRN:CLOSE #5:PUT #4,PRN:CLOSE #4 'player.dat & pdir.dat 10790 GOTO 10040 'menu 10800 '+++++ TALLY SCORES +++++ 10810 CLS:PRINT MNU6$:PRINT:PRINT"ENTER the front side scores for ";B4$ 10820 PRINT:PRINT SPC(6);"Hole # Score" 10830 S=3:N=1:M=9:L=0:GOSUB 720 'get scores in ps(m) 10840 PRINT:PRINT SPC(4);"Score is ";SUM 10850 RESTORE 833:GOSUB 600 'ask for change 10860 T$="Change a front nine score" 10870 IF KB$="Y" THEN M1$="Score":GOSUB 740:GOTO 10850 'make change 10880 CLS:PRINT MNU6$:PRINT:PRINT"ENTER the back side scores for ";B4$ 10890 PRINT:PRINT SPC(6);"Hole # Score" 10900 S=3:N=1:M=9:L=9:GOSUB 720 'get scores in ps(m) 10910 PRINT:PRINT SPC(5);"Score is ";SUM 10920 RESTORE 833:GOSUB 600 'ask for change 10930 T$="Change a back nine score" 10940 IF KB$="Y" THEN M1$="Score":GOSUB 740:GOTO 10920 'make change 10950 '++++++ get adjusted gross score +++++ 10960 GOSUB 650:GOSUB 655:GET #2,RN:GET #3,RN:CLOSE #2,#3 'gcdir.dat,course.dat 10970 IF F4$="m" THEN FOR I=1 TO 18:TMP(I)=VAL(MID$(E2$,I,1)):NEXT' get pars 10980 IF F4$="f" THEN FOR I=1 TO 18:TMP(I)=VAL(MID$(E2$,I,1)):NEXT' get pars 10990 T$=LEFT$(C5$,1):H=VAL(LEFT$(C5$,2)) 11000 IF T$="+" THEN H=-H 'H'cap 11010 GOSUB 13210 '+++++ calculate adjusted gross score +++++ 11020 '+++++ DISPLAY SCORES +++++ 11030 CLS:PRINT SPC(15):COLOR 0,15,0:PRINT" ADJUSTED GROSS SCORES ";:COLOR 7,0,0 11040 PRINT SPC(18);GREG$:PRINT 11050 PRINT "HOLE #";SPC(4); 11060 FOR I=1 TO 9 STEP 3:PRINT USING "###";I;I+1;I+2;:PRINT SPC(1):NEXT I 11070 PRINT "Front"; 11080 FOR I=10 TO 18 STEP 3:PRINT USING "###";I;I+1;I+2;:PRINT SPC(1):NEXT I 11090 PRINT "Back":PRINT SPC(41);"nine";SPC(30);"nine":PRINT "PAR";SPC(8); 11100 FOR I=1 TO 9 STEP 3:PRINT CP(I);CP(I+1);CP(I+2);SPC(1):NEXT I:PRINT CF; 11110 FOR I=10 TO 18 STEP 3:PRINT USING "###";CP(I);CP(I+1);CP(I+2); 11120 PRINT SPC(1):NEXT I:PRINT CB 11130 PRINT "gross score"; 11140 FOR I=1 TO 9 STEP 3:PRINT PS(I);PS(I+1);PS(I+2);SPC(1);:NEXT I:PRINT PF; 11150 FOR I=10 TO 18 STEP 3:PRINT USING "###";PS(I);PS(I+1);PS(I+2); 11160 PRINT SPC(1):NEXT I:PRINT PB 11170 PRINT:COLOR 0,15,0:PRINT " adj.gross "; 11180 FOR I=1 TO 9 STEP 3:PRINT GS(I);GS(I+1);GS(I+2);SPC(1);:NEXT I:PRINT AF; 11190 FOR I=10 TO 18 STEP 3:PRINT USING "###";GS(I);GS(I+1);GS(I+2); 11200 PRINT SPC(1);:NEXT I:PRINT AB:COLOR 7,0,0 11210 '+++++ arrow adjusted scores 11220 T$="adjustments ":N$=CHR$(42)+SPACE$(2):FOR I=1 TO 18 11230 TMP(I)=1:IF GS(I)=PS(I) THEN TMP(I)=0 11240 IF TMP(I)=1 THEN T$=T$+N$ ELSE T$=T$+SPACE$(3) 11250 IF FNNMODM(I,3)=0 THEN T$=T$+SPACE$(1) 11260 IF I=9 THEN T$=T$+SPACE$(5) 11270 NEXT I:PRINT T$:PRINT 11280 '+++++ 11290 PRINT "PAR is ";PAR;" at ";B2$ 11300 PRINT "The player's score is ";:PRINT USING "###";PS 11310 LOCATE CSRLIN+1,15:COLOR 0,15,0:PRINT" The adjusted score is "; 11320 PRINT USING "###";HS;:PRINT" " 11330 LOCATE CSRLIN,15:PRINT " based on handicap of ";C5$ 11340 KB$=B4$:GOSUB 700 'remove excess spaces 11350 LOCATE CSRLIN,15:PRINT" The tally is completed for ";KB$+" ":COLOR 7,0,0 11360 GOSUB 590 11370 '+++++ 11380 ' 11390 CLS:PRINT MNU6$:PRINT 11400 PRINT"For PC-GOLF'S calculations you have two options." 11410 PRINT:PRINT " Option one." 11420 PRINT" 1. Include the adjusted gross score in the handicap calculation." 11430 PRINT" 2. Do not use this score. This was a practice round.":PRINT 11440 M1$="number":M2$="(1 or 2) ":GOSUB 570 11450 RESTORE 814 11460 IF KB=1 THEN GOSUB 600:IF KB$="Y" THEN 11500 ELSE CLS: GOTO 11390 11470 IF KB=2 THEN GOSUB 600:IF KB$="Y" THEN 11890 ELSE CLS:GOTO 11390 11480 PRINT:PRINT"Please choose an option number. ":GOSUB 580:CLS:GOTO 11390 11490 '+++++ get course rating +++++ 11500 CR!=CVS(F2$):IF G4$="r" THEN CR!=CVS(I2$) 11510 IF G4$="g" THEN CR!=CVS(K2$) ELSE IF G4$="b" THEN CR!=CVS(L2$) 11520 ' 11530 '+++++ save the last 20 differentials +++++ 11540 N=1:FOR I=1 TO 19:TMP(I+1)=CVI(MID$(D5$,N,2)):N=N+2:NEXT 11550 TMP(1)=10*HS-INT(10*CR!) 11560 P$="":FOR I=1 TO 20:P$=P$+MKI$(TMP(I)):NEXT 11570 LSET D5$=P$:LSET A5$="V" ' adj.scores valid data 11580 ' 11590 '+++++ calculate new h'cap-sort for low scores +++++ 11600 FOR I=1 TO 19:K=I+1:FOR J=K TO 20 11610 IF TMP(I)<=TMP(J) THEN 11630 11620 T=TMP(I):TMP(I)=TMP(J):TMP(J)=T 11630 NEXT J:NEXT I 11640 K=CVI(O5$)+1:IF K>20 THEN K=20 'count diffs 11650 RSET O5$=MKI$(K) 11660 ' 11670 N=10:IF K=20 THEN 11740 'get # differentials to use 11680 IF K<5 THEN N=1 ELSE IF K=5 THEN N=1 11690 IF K=6 THEN N=2 ELSE IF K=7 THEN N=3 11700 IF K>7 AND K<20 THEN N=INT(K/2) 11710 ' 11720 '+++++ get new h'cap 11730 '+++++ 11740 T!=0:S=20-K+1:F=S+N-1 'set bounds on diffs 11750 FOR I=S TO F:T!=T!+TMP(I):NEXT 'get low diff's 11760 HT$=" ":IF K<20 THEN HT$="T" 11770 X=N*10:T!=P96!*T!:T=CINT(T!/X) ' convert and round 11780 T$=STR$(T):T$=MID$(T$,2,2)+HT$ 11790 IF T!<0 THEN T$="+"+RIGHT$(T$,2) 11800 RSET C5$=T$:RSET D4$=C5$ 11810 GOTO 11880 '+++++ debug 11820 PRINT "adj gross=";HS,"cr=";CR! 11830 PRINT:PRINT"# diffs=";K;" # used=";N;"Hcap=";T$ 11840 T!=0:PRINT"low diffs=";:FOR I=S TO F:PRINT TMP(I);:T!=T!+TMP(I):NEXT:PRINT 11850 PRINT"sum of diffs=";T! 11860 PRINT USING"HCAP= ##.###";T!/N;:PRINT SPC(1)C5$; 11870 STOP 11880 '+++++ 11890 IF HC=1 THEN 11950 'tra if home course 11900 PRINT:PRINT"Option two" 11910 PRINT"The gross scores from this round will not be included in the" 11920 PRINT"player's data bank since the course is not the players home course. 11930 BEEP:GOSUB 590:GOTO 12230 11940 '+++++ 11950 PRINT:PRINT" Option two." 11960 PRINT" 1. Include the gross scores in the players data bank." 11970 PRINT" 2. Do not use these scores. This was a practice round.":PRINT 11980 M1$="number":M2$="(1 or 2) ":GOSUB 570 11990 RESTORE 814 12000 IF KB=1 THEN GOSUB 600:IF KB$="Y" THEN 12060 ELSE CLS:GOTO 11950 12010 IF KB=2 THEN GOSUB 600:IF KB$="Y" THEN 12230 ELSE CLS:GOTO 11950 12020 PRINT:PRINT"Please choose an option number. ":GOSUB 580:CLS:GOTO 11950 12030 '+++++ 12040 ' 12050 '+++++ count the round +++++ 12060 E5=CVI(E5$)+1:RSET E5$=MKI$(E5) 'total rounds tallied 12070 '+++++ save the last 20 actual scores +++++ 12080 N=3:FOR I=2 TO 20:TMP(I)=CVI(MID$(F5$,N,2)):N=N+2:NEXT 12090 P$="":FOR I=2 TO 20:P$=P$+MKI$(TMP(I)):NEXT:P$=P$+MKI$(PS) 12100 LSET F5$=P$:LSET A5$="V" 'last 20 actuals 12110 '+++++ sum the actuals for each hole +++++ 12120 N=1:FOR I=1 TO 18:TX(I)=CVI(MID$(G5$,N,2)):N=N+2 12130 TX(I)=TX(I)+PS(I):NEXT 'sum actuals for each hole 12140 P$="":FOR I=1 TO 18:P$=P$+MKI$(TX(I)):NEXT 12150 LSET G5$=P$ 'actuals for each hole 12160 '+++++ lowest actual score for each hole +++++ 12170 FOR I=1 TO 18:DIF(I)=VAL(MID$(H5$,I,1)) 12180 IF PS(I)1 THEN 12630 12440 '+++++ count the round +++++ 12450 J5=CVI(J5$)+1:RSET J5$=MKI$(J5) 'total rounds tallied 12460 '+++++ save the last 20 actual scores +++++ 12470 N=3:FOR I=2 TO 20:TMP(I)=CVI(MID$(K5$,N,2)):N=N+2:NEXT 12480 P$="":FOR I=2 TO 20:P$=P$+MKI$(TMP(I)):NEXT:P$=P$+MKI$(PS) 12490 LSET K5$=P$:LSET A5$="V" 'last 20 actuals 12500 '+++++ sum the actuals for each hole +++++ 12510 N=1:FOR I=1 TO 18:GS(I)=CVI(MID$(L5$,N,2)):N=N+2 12520 GS(I)=GS(I)+PS(I):NEXT 'sum actuals for each hole 12530 P$="":FOR I=1 TO 18:P$=P$+MKI$(GS(I)):NEXT 12540 LSET L5$=P$ 'actuals for each hole 12550 '+++++ lowest actual score for each hole +++++ 12560 FOR I=1 TO 18:DIF(I)=VAL(MID$(M5$,I,1)) 12570 IF PS(I)=0 13190 'NOTE: Scratch players. Limit one over par on any hole 13200 '+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 13210 PAR=0:CF=0:CB=0:Q=0:HS=0:C=0:PS=0:PF=0:PB=0:AF=0:AB=0 'init 13220 B=H: M=1:N=1:IF H<=0 THEN 13260 'scratch player 13230 M=2:N=1:IF H<19 THEN 13260 'handicap < 19 13240 B=H-18:M=3:N=2:IF H<37 THEN 13260 'handicap < 37 13250 B=H-36:M=4:N=3 'handicap < 41 13260 FOR I=1 TO 18:DIF(I)=PS(I)-CP(I):PAR=PAR+CP(I):PS=PS+PS(I) 13270 IF DIF(I)>=M THEN C=C+1 '# of holes where M over par was made 13280 IF DIF(I) B THEN Q=C-B 'excess # of holes where M over par was made 13310 IF C>B THEN C=B 'set limit on # holes at M over par 13320 HS=HS + M*C + PAR + N*Q 'adjusted score USGA rules 13330 ZZ= M*B + PAR + N*(18-B) 'max allowed over par score 13340 T1=0 13350 FOR I=1 TO 18 'get adj. scores for each hole 13360 IF DIF(I)>=M AND T1<=B THEN GS(I)=CP(I)+M:T1=T1+1 'max over par this hole 13370 IF DIF(I)>=M AND T1>B THEN GS(I)=CP(I)+N 'max score for this hole 13380 IF DIF(I)