10 REM PRINT WEEKLY RECAP SHEET    (RECAP)
12 REM Developed by William W. Klaproth,  Moraga Ca.  94556    September 1982
20 REM MASTER FILE DESCRIPTIONS FOR ALL BOWLING PROGRAMS
30 OPEN "B:TEAMS.HDR" AS #1 LEN = 64
40 FIELD #1, 2 AS TM$, 30 AS NAM$, 2 AS RCNT$, 2 AS GAM$, 4 AS PINS$, 2 AS AVG$, 2 AS HIG$, 2 AS HIS$, 4 AS PTSW$, 4 AS PTSL$, 2 AS B1ID$, 2 AS B2ID$, 2 AS B3ID$, 2 AS B4ID$, 2 AS B5ID$
50 FIELD #1, 2 AS HDRID$, 30 AS LEAGUE$, 2 AS WEEKS$, 2 AS TEAMS$, 4 AS FILLER$, 2 AS BWLPERTM$, 2 AS NXTID$, 2 AS HCPBASE$, 4 AS HCPPCNT$
60 OPEN "B:BOWLERS.HDR" AS #2 LEN = 64
70 FIELD #2, 2 AS BBO$, 30 AS BNAM$, 2 AS BRCNT$, 2 AS BGAM$, 4 AS BPINS$, 2 AS BAVG$, 2 AS BHIG$, 2 AS BHIS$, 2 AS BHCP$, 2 AS BHIGH$, 2 AS BHISH$, 2 AS BTM$,2 AS GAM2$, 2 AS SER5$, 2 AS SER6$,2 AS CURSER$,2 AS AVGLSTYR$
80 REM OPEN "B:TEAM.DET" AS #3 LEN = 16
90 REM FIELD #3,2 AS DTM$, 2 AS TMO$, 2 AS TDAY$, 2 AS TG1$, 2 AS TG2$, 2 AS TG3$, 2 AS TSER$, 2 AS DPTSW$
100 REM OPEN "B:BOWLER.DET" AS #4 LEN = 16
110 REM FIELD #4,2 AS DBO$, 2 AS BMO$, 2 AS BDAY$, 2 AS BG1$, 2 AS BG2$, 2 AS BG3$, 2 AS BSER$
120 CLS
130 PRINT "PRINT WEEKLY RECAP SHEET"
140 GET #1,1
150 TEAMS% = CVI(TEAMS$)
160 BOWLERS% = CVI(BWLPERTM$)
170 WEEKS% = CVI(WEEKS$)
180 NEXTID% = CVI(NXTID$)
190 DIM TM%(TEAMS%)
200 DIM NAM$(TEAMS%)
210 DIM GAM%(TEAMS%)
220 DIM PINS(TEAMS%)
230 DIM AVG%(TEAMS%)
240 DIM HIG%(TEAMS%)
250 DIM HIS%(TEAMS%)
260 DIM PTSW(TEAMS%)
270 DIM PTSL(TEAMS%)
280 REM BOWLER SCORES TABLES
290 DIM BONUM%(NEXTID% - 1)     'TABLE FOR HI GAME
300 DIM HIGAME%(NEXTID% - 1)    ' *
310 DIM BONUM2%(NEXTID% - 1)     'TABLE FOR HI SERIES
320 DIM HISERIES%(NEXTID% - 1)  ' *
330 D% = 0       'SET START OF SCORES TABLE
340 LPRINT "RHEEM VALLEY BOWL          ";LEAGUE$;SPC(10);DATE$
350 LPRINT " "
360 DIM TABTM%(TEAMS%)
370 DIM TABPTS#(TEAMS%)
380 FOR T% = 1 TO TEAMS%
390 GET #1, (T% + 1)
400 TM%(T%) = CVI(TM$)
410 NAM$(T%) = NAM$
420 GAM%(T%) = CVI(GAM$)
430 PINS(T%) = CVS(PINS$)
440 AVG%(T%) = CVI(AVG$)
450 HIG%(T%) = CVI(HIG$)
460 HIS%(T%) = CVI(HIS$)
470 PTSW(T%) = CVS(PTSW$)
480 PTSL(T%) = CVS(PTSL$)
490 TABTM%(T%) = TM%(T%)                          'LOAD SORT TABLE
500 TABPTS#(T%) = PTSW(T%) * 1000000! + PINS(T%)   ' *
510 NEXT T%
520 REM SORT TEAMS BY POINTS WON
530 PRINT "SORTING TEAMS BY POINTS WON"
540 M% = TEAMS%: LAST$ = " "
550 M% = M% / 2
560 IF LAST$ = "Y" GOTO 700
570 IF M% = 1 THEN LAST$ = "Y"
580 K% = TEAMS% - M%: J% = 1
590 I% = J%
600 L% = I% + M%
610 IF TABPTS#(I%) <= TABPTS#(L%) GOTO 670
620 TEMPPTS# = TABPTS#(I%): TEMPTM% = TABTM%(I%)
630 TABPTS#(I%) = TABPTS#(L%): TABTM%(I%) = TABTM%(L%)
640 TABPTS#(L%) = TEMPPTS#: TABTM%(L%) = TEMPTM%
650 I% = I% - M%
660 IF I% > 0 GOTO 600
670 J% = J% + 1
680 IF J% > K% GOTO 550 ELSE GOTO 590
690 REM END OF INTERNAL SORT ROUTINE
700 PRINT "PRINTING TEAM STANDINGS"
710 LPRINT "PLACE TEAM                            WON   LOST   PINS   GAM  AVG  HIG  HIS"
720 LPRINT "----- -----                           ---   ----   ----   ---  ---  ---  ---"
730 PLACE% = 1
740 FOR PL% = TEAMS% TO 1 STEP -1
750 T% = TABTM%(PL%)
760 LPRINT USING "  ##  ";PLACE%;
770 LPRINT NAM$(T%);
780 LPRINT USING "###.#  ";PTSW(T%),PTSL(T%);
790 LPRINT USING "#####  ";PINS(T%);
800 LPRINT USING " ### ";GAM%(T%);
810 LPRINT USING "#### ";AVG%(T%),HIG%(T%),HIS%(T%)
820 PLACE% = PLACE% + 1
830 NEXT PL%
840 LPRINT "*****************************************************************************"
850 PRINT "PRINTING BOWLER RECAP"
860 LPRINT "TEAM NAME                           SER   PINS GMS  AVG  HIG  HIS 200 500 600"
870 LPRINT "---- -----                          ---   ---- ---  ---  ---  --- --- --- ---"
880 FOR T% = 1 TO TEAMS%
890 GET 1, (T% + 1)
900 BID%(1) = CVI(B1ID$)
910 BID%(2) = CVI(B2ID$)
920 BID%(3) = CVI(B3ID$)
930 BID%(4) = CVI(B4ID$)
940 BID%(5) = CVI(B5ID$)
950 FOR B% = 1 TO BOWLERS%
960 GET #2,BID%(B%)
970 IF B% = 1 THEN LPRINT USING " ##  ";T%;
980 IF B% > 1 THEN LPRINT "     ";
990 LPRINT BNAM$;
1000 CURSER% = CVI(CURSER$)
1010 IF CURSER% > 50 THEN GOTO 1040 ELSE LPRINT " A-";
1020 LPRINT USING "# ";CURSER%;
1030 GOTO 1050
1040 LPRINT USING " ### ";CURSER%;
1050 LPRINT USING " ##### ";CVS(BPINS$);
1060 LPRINT USING "### ";CVI(BGAM$);
1070 LPRINT USING " ### ";CVI(BAVG$),CVI(BHIG$),CVI(BHIS$);
1080 GAM2% = CVI(GAM2$): SER5% = CVI(SER5$): SER6% = CVI(SER6$)
1090 IF GAM2% = 0 THEN LPRINT SPC(4) ELSE LPRINT USING "### ";CVI(GAM2$);
1100 IF SER5% = 0 THEN LPRINT SPC(4) ELSE LPRINT USING "### ";CVI(SER5$);
1110 IF SER6% > 0 THEN LPRINT USING "### ";CVI(SER6$) ELSE LPRINT SPC(6)
1120 D% = D% + 1
1130 BONUM%(D%) = CVI(BBO$)      'MOVE SCORES TO TABLE FOR SORTING
1140 HIGAME%(D%) = CVI(BHIG$)    ' *
1150 BONUM2%(D%) = BONUM%(D%)    ' *
1160 HISERIES%(D%) = CVI(BHIS$)  ' *
1170 NEXT B%
1180 NEXT T%
1190 LPRINT "*****************************************************************************"
1200 PRINT "PRINTING SUBSTITUTE RECAP"
1210 LPRINT "SUBS"
1220 FOR S% = 1 TO (NEXTID% - 1)
1230 GET #2,S%
1240 IF CVI(BTM$) > 0 GOTO 1370
1250 LPRINT "  ";
1260 LPRINT USING "## ";CVI(BBO$);
1270 LPRINT BNAM$;
1280 CURSER% = CVI(CURSER$)
1290 IF CURSER% < 50 THEN LPRINT SPC(5) ELSE LPRINT USING " ### ";CURSER%;
1300 LPRINT USING " ##### ";CVS(BPINS$);
1310 LPRINT USING "### ";CVI(BGAM$);
1320 LPRINT USING " ### ";CVI(BAVG$),CVI(BHIG$),CVI(BHIS$);
1330 GAM2% = CVI(GAM2$): SER5% = CVI(SER5$): SER6% = CVI(SER6$)
1340 IF GAM2% = 0 THEN LPRINT SPC(4) ELSE LPRINT USING "### ";CVI(GAM2$);
1350 IF SER5% = 0 THEN LPRINT SPC(4) ELSE LPRINT USING "### ";CVI(SER5$);
1360 IF SER6% > 0 THEN LPRINT USING "### ";CVI(SER6$) ELSE LPRINT SPC(6)
1370 NEXT S%
1380 LPRINT CHR$(12)
1390 LPRINT " "
1400 LPRINT "     HIGH GAME                       HIGH SERIES"
1410 LPRINT "     ---------                       -----------"
1420 REM SORT HIGAME SCORES
1430 PRINT "SORTING BOWLER HIGAME SCORES"
1440 M% = NEXTID% - 1: LAST$ = " "
1450 M% = M% / 2
1460 IF LAST$ = "Y" GOTO 1610
1470 IF M% = 1 THEN LAST$ = "Y"
1480 K% = (NEXTID% - 1) - M%: J% = 1
1490 I% = J%
1500 L% = I% + M%
1510 IF HIGAME%(I%) <= HIGAME%(L%) GOTO 1570
1520 TEMPGAME% = HIGAME%(I%): TEMPBO% = BONUM%(I%)
1530 HIGAME%(I%) = HIGAME%(L%): BONUM%(I%) = BONUM%(L%)
1540 HIGAME%(L%) = TEMPGAME%: BONUM%(L%) = TEMPBO%
1550 I% = I% - M%
1560 IF I% > 0 GOTO 1500
1570 J% = J% + 1
1580 IF J% > K% GOTO 1450 ELSE GOTO 1490
1590 REM END OF HIGAME SORT ROUTINE
1600 REM SORT HISERIES SCORES
1610 PRINT "SORTING BOWLER HISERIES SCORES"
1620 M% = NEXTID% - 1: LAST$ = " "
1630 M% = M% / 2
1640 IF LAST$ = "Y" GOTO 1780
1650 IF M% = 1 THEN LAST$ = "Y"
1660 K% = (NEXTID% - 1) - M%: J% = 1
1670 I% = J%
1680 L% = I% + M%
1690 IF HISERIES%(I%) <= HISERIES%(L%) GOTO 1750
1700 TEMPSERIES% = HISERIES%(I%): TEMPBO% = BONUM2%(I%)
1710 HISERIES%(I%) = HISERIES%(L%): BONUM2%(I%) = BONUM2%(L%)
1720 HISERIES%(L%) = TEMPSERIES%: BONUM2%(L%) = TEMPBO%
1730 I% = I% - M%
1740 IF I% > 0 GOTO 1680
1750 J% = J% + 1
1760 IF J% > K% GOTO 1630 ELSE GOTO 1670
1770 REM END OF HISERIES SORT ROUTINE
1780 BEEP
1790 INPUT "HOW MANY LINES OF HIGH SCORES DO YOU WISH TO PRINT:";LINES%
1800 LIMIT% = (NEXTID% - LINES%)
1810 PRINT "PRINTING LEAGUE HIGH SCORES"
1820 FOR PL% = (NEXTID% - 1) TO LIMIT% STEP -1
1830 GET #2,BONUM%(PL%)
1840 HIGNAM$ = LEFT$(BNAM$,20)
1850 GET #2,BONUM2%(PL%)
1860 LPRINT SPC(5);HIGNAM$;
1870 LPRINT USING "  ###";HIGAME%(PL%);
1880 LPRINT SPC(7);LEFT$(BNAM$,20);
1890 LPRINT USING "  ###";HISERIES%(PL%)
1900 NEXT PL%
1910 LPRINT " "
1920 LPRINT "                    HI LITES LAST WEEK"
1930 LPRINT "                    ------------------"
1940 LPRINT " "
1950 REM READ HILITE RECORDS FROM FILE #5
1960 L% = NEXTID%
1970 DIM HBNO%(L%)
1980 DIM HG1%(L%)
1990 DIM HG2%(L%)
2000 DIM HG3%(L%)
2010 DIM HSER%(L%)
2020 DIM FLG1$(L%)
2030 DIM FLG2$(L%)
2040 DIM FLG3$(L%)
2050 DIM FLGS$(L%)
2060 DIM HCNT%(L%)
2070 DIM SCOR%(4)
2080 OPEN "B:HISCORES.DET" AS #5 LEN = 16
2090 FIELD #5, 2 AS HBNO$, 2 AS HG1$, 2 AS HG2$, 2 AS HG3$, 2 AS HSER$, 1 AS HFLG1$, 1 AS HFLG2$, 1 AS HFLG3$, 1 AS HFLGS$, 2 AS HCNT$
2100 PRINT "PROCESSING LAST WEEK'S HILITES"
2110 HILITE% = 0
2120 FOR T% = 1 TO L%
2130 GET #5,T%
2140 HG1%(T%) = CVI(HG1$)
2150 IF HG1%(T%) = 9999 GOTO  2210
2160 HBNO%(T%) = CVI(HBNO$): HG2%(T%) = CVI(HG2$)
2170 HG3%(T%) = CVI(HG3$): HSER%(T%) = CVI(HSER$)
2180 FLG1$(T%) = HFLG1$: FLG2$(T%) = HFLG2$: FLG3$(T%) = HFLG3$: FLGS$(T%) = HFLGS$: HCNT%(T%) = CVI(HCNT$)
2190 IF HCNT%(T%) > 0 THEN HILITE% = HILITE% + 1
2200 NEXT T%
2210 PRSW$ = "L"
2220 FOR V% = 1 TO L%
2230 IF HG1%(V%) = 9999 GOTO 2470
2240 IF HCNT%(V%) = 0 GOTO 2450
2250 GET #2,HBNO%(V%)
2260 U% = 1
2270 IF FLG1$(V%) = "1" THEN SCOR%(U%) = HG1%(V%):U%=U%+1
2280 IF FLG2$(V%) = "1" THEN SCOR%(U%) = HG2%(V%):U%=U%+1
2290 IF FLG3$(V%) = "1" THEN SCOR%(U%) = HG3%(V%):U%=U%+1
2300 IF FLGS$(V%) = "1" THEN SCOR%(U%) = HSER%(V%):U%=U%+1
2310 IF U% = 1 GOTO 2440
2320 LPRINT LEFT$(BNAM$,20);
2330 ON U% GOTO 2440,2340,2370,2400,2430
2340 LPRINT USING "### ";SCOR%(1);
2350 LPRINT "            ";
2360 GOTO 2440
2370 LPRINT USING "### ";SCOR%(1),SCOR%(2);
2380 LPRINT "        ";
2390 GOTO 2440
2400 LPRINT USING "### ";SCOR%(1),SCOR%(2),SCOR%(3);
2410 LPRINT "    ";
2420 GOTO 2440
2430 LPRINT USING "### ";SCOR%(1),SCOR%(2),SCOR%(3),SCOR%(4);
2440 IF PRSW$ = "R" THEN LPRINT " "
2450 IF PRSW$ = "R" THEN PRSW$ = "L" ELSE PRSW$ = "R"
2460 NEXT V%
2470 LPRINT " ": IF PRSW$ = "R" THEN LPRINT " "
2480 DIM MESG$(7)
2490 K% = 1
2500 LINE INPUT "ENTER MESSAGES:";MESG$(K%)
2510 TMSG$ = MESG$(K%)
2520 FIRST4$ = LEFT$(TMSG$,4)
2530 IF FIRST4$ = "*END" OR FIRST4$ = "*end" GOTO 2570
2540 IF K% = 7 GOTO 2580
2550 K% = K% + 1
2560 GOTO 2500
2570 K% = K% - 1
2580 LPRINT " "
2590 INPUT "ENTER NEXT BOWLING DATE (MM,DD): ",SMO%,SDY%
2600 IF SMO% = 0 GOTO 2860
2610 OPEN "B:SCHEDULE.DET" AS #3 LEN = 75
2620 FIELD #3, 1 AS STATUS$, 2 AS WEEK$, 2 AS SMO$, 2 AS SDY$, 68 AS PRLINE$
2630 GET #3,1
2640 LPRINT "DATE\ LANE ";PRLINE$
2650 LPRINT "-----    ";
2660 FOR LN% = 1 TO TEAMS% / 2
2670 LPRINT "  -----";
2680 NEXT LN%
2690 LPRINT " "
2700 FOR L% = 2 TO 40
2710 GET #3,L%
2720 IF CVI(SMO$) = 99 GOTO 2750
2730 IF SMO% = CVI(SMO$) THEN IF SDY% = CVI(SDY$) GOTO 2770 ELSE GOTO 2740
2740 NEXT L%
2750 PRINT "**ERROR - NO MATCH FOUND IN SCHEDULE FILE"
2760 STOP
2770 FOR M% = L% TO (L% + 2)
2780 GET #3, M%
2790 IF CVI(SMO$) = 99 GOTO 2850
2800 LPRINT USING "##";CVI(SMO$);
2810 LPRINT USING "/##";CVI(SDY$);
2820 LPRINT SPC(6);
2830 LPRINT PRLINE$
2840 NEXT M%
2850 LPRINT " "
2860 FOR L% = 1 TO K%
2870 LPRINT MESG$(L%)
2880 NEXT L%
2890 LPRINT CHR$(12)
2900 PRINT "Print Processing Completed - Returning to MENU"
2910 CLOSE
2920 RUN "A:MENU"