Classic Computer Magazine Archive COMPUTE! ISSUE 57 / FEBRUARY 1985 / PAGE 126

Apple Bowling Champ

Original Program By Joseph Ganci
Apple Adaptation By Patrick Parrish, Programming Supervisor

Now you can go bowling without the expense of renting special shoes or suffering the embarrassment of rolling a gutter ball in front of dozens of people. "Bowling Champ" is a game for one to four players which runs on any Apple II-series computer.



Some computer games, such as Pac-Man or Adventure, create their own unique fantasy worlds, while others are simulations of reality. "Apple Bowling Champ" is an example of the latter.
    It's not easy to take a game with countless physical variables such as bowling and reduce it to numbers so it can be re-created by a computer-especially a microcomputer. Compromises must be made. Usually the game must be modified in major ways to make it possible to program. The result is a hybrid game, an approximation of reality, that resembles the original but has new aspects of its own.
    Apple Bowling Champ is a reasonable simulation of a game of tenpins, given the limitations imposed by a BASIC program which must remain short enough to publish in a magazine. The elements of skill and luck have been preserved, and the scoring is authentic.

Up To Four Players
When you run Bowling Champ, the program asks for the number of players. Up to four people can play. Next, enter the players' names. To fit the names on the 40-column screen, the program truncates entries to eight characters.
    Now you're ready to bowl the first frame. The bowling ball moves rapidly up and down across the alley until you press the space bar. This rolls the ball down the alley and knocks over the pins-unless you've thrown a gutter ball. The trick is to time your release so the ball rolls down the center of the alley to score a strike.
    In case you're unfamiliar with how a game of tenpins is scored, here's a brief summary.
    A game consists of ten frames or turns. Each player gets one or two balls per frame. If you roll a strike-knocking down all tenpins with your first ball-you don't get a second ball, but the current ball's score is ten plus the total of your next two throws.
    If some pins are left standing after your first ball, you get a second ball. If you knock down all the remaining pins, it counts as a spare, and the current ball's score is ten plus your next throw.
    If any pins remain after your second ball (no strike or spare), the number of pins knocked down in that frame is added to your previous score.
    Rolling a spare in the tenth (last) frame gains you one extra ball; rolling a strike in the tenth frame gains two extra balls.
    Therefore, a perfect game-ten strikes during regular play plus two strikes with the extra balls-scores 300 points. Needless to say, this doesn't happen very often, either in real bowling or in Bowling Champ.
    Since Bowling Champ follows every rule of scoring for regular bowling, you can learn how to score by carefully observing the game. The only difference is that the computer does not wait until the end of a frame to update the score; it updates it after every ball.

Apple Bowling Champ
Four players compete in "Apple Bowling Champ": A
blinking bowling pin next to a player's scorecard shows
whose turn is next.


Adjusting The Difficulty
Novice bowlers may find that the ball moves too fast for them to aim. On the other hand, more experienced players may want to speed up the ball to make the game harder. You can easily make either modification by changing the delay loop in line 480. The statement in 480 reads:

480 FOR R=1 TO 10:NEXT

    Replacing the 10 with a larger number slows down the ball; a smaller number speeds up the ball. You might try a value between 20 and 50 for youngsters. For expert players, remove line 480 altogether.

Apple Bowling Champ

100  HIMEM: 36096: GOSUB 770
110  GOSUB 830: GOSUB 970
120  GOSUB 1160
130  HOME : POKE 230,32: CALL 62450: HGR
     : POKE 6,0: POKE 7,141: POKE 54,0:
      POKE 55,3: CALL 1002
140  GOSUB 1230
150  REM -MAIN LOOP-
160  FOR Q = 1 TO 10: FOR Z9 = 0 TO A -
     1
170  FOR R = 1 TO 10: VTAB 2 * (Z9 + 1)
      + 1: HTAB 1: PRINT " ";: FOR F =
     1 TO 30: NEXT F: HTAB 1: PRINT "S"
     : FOR F = 1 TO 30: NEXT F: NEXT R
180 B1 = 0: GOSUB 360
190  IF J1 < > 10 THEN B1 = 1: GOSUB 3
     90
200  IF Q = 10 THEN ON S GOTO 210,270,
     270,210,310
210  VTAB (Z9 + 1) * 2 + 1: HTAB 1: PRINT
     " ": NEXT : NEXT : VTAB 24: HTAB 1
     0: POKE - 16368,0 PRINT "PLAY AG
     AIN (Y/N)?";
220  IF PEEK ( - 16384) < 128 THEN 220
230 K = PEEK ( - 16384) - 128: IF K <
      > 78 AND K < > 89 THEN POKE -
     16368,0: GOTO 220
240  IF K = 89 THEN 120
250  POKE - 16368,0: HOME : TEXT : END
260  REM -10TH FRAME : EXTRA BALLS-
270  VTAB 24: HTAB 5: PRINT "TAKE TWO M
     ORE BALLS, "NA$(Z9 + 1);".";
280  FOR I = 1 TO 2000: NEXT : VTAB 24:
      HTAB 5: PRINT SPC( 30);
290 S(Z9) = S - 1:B1 = 1: GOSUB 360: IF
     J < > 10 THEN 340
300  GOTO 330
310  VTAB 24: HTAB 5: PRINT "TAKE ONE M
     ORE BALL, "NAS(Z9 + 1);".";
320  FOR I = 1 TO 2000: NEXT : VTAB 24:
      HTAB 5: PRINT SPC( 29);
330 S(Z9) = 1:B1 = 2: GOSUB 360: GOTO 2
     10
340 S(Z9) = 1:B1 = 2: GOSUB 390: GOTO 2
     10
350  REM -FIRST BALL-
360  FOR I = 1 TO 10: VTAB A(I): HTAB B
     (I): PRINT "$": NEXT
370 PS = 1:J1 = 0: GOTO 400
380  REM -SECOND BALL-
390 PS = 0
400  GOSUB 450:T = T(Z9):S = S(Z9):T =
     T + J
410  ON S(Z9) GOSUB 660,690,710,730,750
420 T(Z9) = T:S(Z9) = S
430  VTAB 21 + (A < 3) + 2 * (Z9 > 1) *
     (A > 2): HTAB 37 - (Z9 / 2 = INT
     (Z9 / 2)) X 22: PRINT T(Z9): RETURN
440 REM -ROLL BALL-
450 H = 1:C = 19:E = 11:D = - 1: POKE
      - 16368,0
460  FOR V = C TO E STEP D: HTAB H: VTAB
     V: PRINT "*";
470  IF PEEK ( - 16384) > 127 THEN T5 =
     V:V = E: NEXT : GOTO 510
480  FOR R = 1 TO 10: NEXT
490  HTAB H: PRINT " ";
500  NEXT V:D = - D:T5 = C:C = E:E = T
     5: GOTO 460
510 V = T5: FOR H = 1 TO 35: HTAB H: VTAB
     V: PRINT " *";: FOR K = 1 TO 10: NEXT
     : NEXT
520 J = 0
530  IF ( SCRN( H,2 * (V - 1)) + 16 * SCRN(
     H,2 * (V - 1) + 1) - 128) < > 36 THEN
     570
540  POKE - 16336,0:J = J + 1: FOR D =
     - 1 TO 1 STEP 2:X1 = V:X2 = H
550 X1 = X1 + D:X2 = X2 +,1: IF ( SCRN(
     X.2,(X1 - 1) * 2) + 16 * SCRN( X2,
     (X1 - 1) * 2 + 1) - 128) = 36 THEN
      HTAB X2 + is VTAB X1: PRINT " ";:
     J = J + 1: POKE - 16336,0: GOTO 5
     50
560  NEXT
570  HTAB H: VTAB V: PRINT " *";:H = H +
     1: IF H < 40 THEN 530
580 J1 = J1 + J
590  VTAB 2 * Z9 + 3: HTAB 7 + 3 * 0 +
     B1:G = J + 48
600  IF J1 < > 10 THEN 630
610  IF: PS THEN G : 88. GOTO 630
620 G = 47
630  PRINT CHR$ (G)
640  HTAB H: VTAB V: PRINT " ";: RETURN
650  REM -SCORING ROUTINES-
660  IF Jl < > 10 THEN RETURN
670  IF PS THEN S = 2: RETURN
680 S = 5: RETURN
690 T = T + J: IF J = 10 THEN S = 3: RETURN
700 S = 4: RETURN
710 T = T + J * 2: IF J <  > 10 THEN S =
     4
720  RETURN
730 7 = T + J: IF J1 = 10 THEN S = 5: RETURN
740 S = 1: RETURN
750 7 = T + J: IF J = 10 THEN S = 2: RETURN
760 S = 1: RETURN
770  DIM A(10),B(10): FOR I = 1 TO 10: READ
     A(I),B(I):X = X + A(I) + B(I): NEXT
     : IF X < > 540 THEN PRINT "ERROR
      IN DATA STATEMENTS FOR PIN POSITI
     ONS.": STOP
780  RETURN
790  REM -PIN DATA-
800  DATA 12,40,13,39,14,38,14,40
810  DATA 15,37,15,39,16.38,16,40
820  DATA 17,39,18,40
830 X = 0: FOR I = 768 TO 852: READ A:X
      = X + A: POKE I,A: NEXT : IF X <
      > 7734 THEN PRINT "ERROR IN DATA
      STATEMENTS FOR ML AT 768.": STOP
840  DATA 133,69,134,70,132,71,166,7
850  DATA 10,10,176,4,16,62,48,4
860  DATA 16,1,232,232,10,134,27,24
870  DATA 101,6,133,26,144,2,230,27
880  DATA 165,40,133,8,165,41,41,3
890  DATA 5,230,133,9,162,8,160,0
900  DATA 177,26,36,50,48,2,73,127
910  DATA 164,36,145,8,230,26,208,2
920  DATA 230,27,165,9,24,105,4,133
930  DATA 9,202,208,226,165,69,166,70
940  DATA 164,71,76,240,253
950  RETURN
960  REM LOAD REDEFINED CHARACTERS
970 X = 0:AD = 36096: FOR L = 1 TO 16: READ
     B: FOR I = AD + B TO AD + B + 7: READ
     A:X = X + A: POKE I,A: NEXT :X = X
      + B: NEXT : IF X < > 6223 THEN PRINT
     "ERROR IN CHARACTER DATA STATEMENT
     S.": STOP
980  RETURN
990  DATA 0,0,0,0,0,0,0,0,0
1000  DATA 24,20,20,62,20,62,20,20,0
1010  DATA 32,8,28,8,28,28,62,62,28
1020  DATA 80,28,62,127,127,127,62,28,
     0
1030  DATA 120,63,31,79,103,115,121,12
     4,126

1040  DATA 128,28,34,50,42,38,34,28,0
1050  DATA 136,8,12,8,8,8,8,28,0
1060  DATA 144,28,34,32,24,4,2,62,0

1070  DATA 152,62,32,16,24,32,34,28,0
1080  DATA 160,16,24,20,18,62,16,16,0
1090  DATA 168,62,2,30,32,32,34,28,0
1100  DATA 176,56,4,2,30,34,34,28,0
1110  DATA 184,62,32,16,8,4,4,4,0
1120  DATA 192,28,34,34,28,34,34,28,0
1130  DATA 200,28,34,34,60,32,16,14,0
1140  DATA 448,34,34,20,8,20,34,34,0
1150  REM TITLE SCREEN
1160  TEXT : HOME : VTAB 7: HTAB 12: PRINT
     "BOWLING CHAMP"': FOR I = 1 TO 4:N
     A$(I) = "": NEXT
1170  POKE - 16368,0: VTAB 10: HTAB 7:
      PRINT "HOW MANY BOWLERS (1-4): ";
1180  IF PEEK ( - 16384) < 128 THEN 11
     80
1190 A = PEEK ( - 16384) - 128: IF A <
     49 OR A > 52 THEN 1160
1200  PRINT CHR$ (A):A = A - 48: POKE
      - 16368,0: FOR T = 1 TO A: VTAB 1
     4 + 1: HTAB 6: PRINT "BOWLER #"I"'
     S NAME :    ' ,
1210  INPUT A$:NA$(I) = LEFT$ (AS,8): NEXT
     : FOR I = 0 TO A - 1:T(I) = 0: NEXT
     : RETURN
1220  REM DRAW GAME SCREEN
1230  VTAB 1: HTAB 10: PRINT "1 2 3
     4 5 6 7 8 9 10"
1240  HCOLOR= 3: HPLOT 63,11 TO 279,11
1250  FOR I = 1 TO A: VTAB 2 * I + 1: HTAB
     3: PRINT "# "I
1260  FOR J = 12 TO 36 STEP 3: HPLOT 7 *
     (J - 1 ) + 3 , I * 2 * 8 TO 7 * ( J -
     1) + 3,1 * 2 * 8 + 8: NEXT
1270  HPLOT 63,2 * I * 8 + 11 TO 279,2 *
     I * 8 + 11: NEXT
1280  FOR I = 1 TO A STEP 2: VTAB 20 +
     (A < 3) + I: HTAB 1: PRINT " #"I"
     "NA$(I)":";: IF NA$(I + 1) < > ""
      THEN HTAB 23: PRINT " #I + 1"
     NA$(I + 1)":"
1290  NEXT I
1300  HPLOT 0,75 TO 279,75: HPLOT 0,155
      TO 279,155
1310  FOR I = 0 TO A - 1:S(I) = 1: NEXT
     : RETURN : REM INITIALIZE SCORE S
     TATE