This program came with the Altair 8800, 8K BASIC.
I remember this game because as a graduation present, my parents bought me an Altair 8800. I loved working with that computer, and it helped me to understand how to code in machine code, which came in handy when I was a systems programmer and had to solve problems on an IBM 360/67 mainframe. The lights and switches worked just like the ones on the Altair 8800, but 360 showed a lot more registers. memory, and instruction sets.
So I have gone back and got a Altair Clone, so you will see some oldies but goodies here.
I plan to add graphics to this game once I unspaghettify the code (I also have a QB64 version of Microsoft's Remove Line Numbers program, which I will also post here.
I first got this code to run on my iPad using TechBASIC (a modified version GSoft BASIC, but designed to work with sensors and Arduino and PI boards), that made the conversion to QB64 easier, as GSoft BASIC ran on the Apple IIgs.
Also, in modifying the code for QB64, I am also attaching to this post the Veranda ttf Font File, as I use it in the code. You can look at the Screen section and replace that with any font you like.
Here is the program.
_TITLE "BASEBALL (TEXT VERSION)"
REM "BASEBALL SIMULATION PROGRAM (TEXT MODE) REM "A VERSION OF THIS PROGRAM RAN
ON THE ALTAIR
8800 8K BASIC
(1977) REM "WRITTEN BY JOEL LIND & KEN BIRKMAN - NYU - JULY 1973 REM "STOLEN
AND ENHANCED DECEMBER
1973 BY R. D. KURLAND
- NYU
REM "RESTOLEN AND CONVERTED TO RUN IN TECHBASIC (JULY 7, 2020) BY GEORGE MCGINN REM "CONVERTED FROM TECHBASIC
TO QB64
(JULY
7, 2020) BY GEORGE MCGINN
'***************************************************
' SETUP SCREEN FORMAT & SIZE, FONT TYPE & SIZE
'***************************************************
'*** Setup Screen Format and Size
'*** Setup and load Font Type, Format and Size
fontpath$ = "Veranda.tff"
130 DIM B
(7), P$
(9), W$
(7), J$
(8), K$
(4) 150 BA = 0: T9 = 0: R9 = 0: S = 0: O = 0: B1 = 0: B2 = 0: T = 0
160 Z1 = 1: Z2 = 1
170 PRINT "WELCOME TO EBBETT'S FIELD" 180 PRINT "WHAT DO YOU WANT TO CALL YOUR TEAM ";
240 PRINT "FINE. THE "; A$;
" NEED A MANAGER. WHAT'S YOUR NAME ";
260 PRINT "WHAT DO YOU WANT TO CALL MY TEAM, "; B$;
290 PRINT "OPENING DAY, THE "; A$;
" VERSUS THE "; C$
310 PRINT "LET'S FLIP A COIN. THE WINNER IS THE HOME TEAM." 320 PRINT "HEADS OR TAILS ";
380 H = 1
400 Y$ = "HEADS"
410 IF Y
> .5 THEN Y$
= "TAILS" 430 H = 0
440 PRINT "YOU LOST THE TOSS. THE "; A$;
" ARE UP FIRST." 470 A = 0
490 PRINT "YOU WIN THE TOSS. "; A$;
" TAKE THE FIELD, AND ";
500 PRINT C$;
" ARE AT BAT." 510 A = 1
520 R9 = 0
530 T = T + 1
620 T = T + 1
630 R9 = 0
710 S = 0: BA = 0
760 P = B(1) + B(2) + B(3)
810 Y$ = "RUNNER ON "
820 IF P
> 1 THEN Y$
= "RUNNERS ON " 960 IF BA
> 0 OR S
> 0 THEN PRINT "THE COUNT IS "; BA;
" AND "; S
990 PRINT "WHAT WILL YOUR BATTER DO, "; B$;
1080 N = 1
1100 B(1) = 0
1130 ON C
GOTO 1140, 1450, 2600, 4450, 5500 1140 C = 1
1160 IF A
= 0 THEN Z1
= Z1
+ 1 1210 BA = BA + 1
1240 PRINT J$
(Y
);
" - BALL "; BA
1300 PRINT "HIGH POP - FOUL DOWN THE "; Y$;
" FIELD LINE" 1310 S = S + 1
1350 PRINT K$
(Y
);
", CALLED STRIKE "; S
1370 PRINT "SWINGING STRIKE "; S
1410 O = O + 1
1450 C = 2
1480 IF A
= 0 THEN Z2
= Z2
+ 1 1510 IF S
<> 2 OR Z2
/ Z1
< 25 THEN 1590 1540 ON Y
GOTO 1610, 1310, 1310, 1310, 1310, 1680, 1610 1560 ON Y
- 7 GOTO 1680, 1310, 1740, 1850, 1740, 1850 1580 ON Y
- 13 GOTO 1980, 1980, 2040, 2570, 1640, 2570 1600 ON Y
- 2 GOTO 1610, 1680, 1740, 1850, 1980, 2040, 2570 1610 PRINT "FOULED INTO THE STANDS-OUT OF PLAY" 1650 Y$ = "RIGHT"
1660 IF Y
< .5 THEN Y$
= "LEFT" 1700 PRINT "FOULED BACK INTO THE STANDS" 1720 PRINT "POPPED IT UP - CAUGHT BY CATCHER" 1740 PRINT "INFIELD GROUNDER" 1770 PRINT "1 BASE ERROR!!" 1780 N = 1
1790 C = 4
1850 PRINT "GROUNDER - COULD BE TROUBLE - " 1880 Y$ = "UP THE MIDDLE"
1890 IF Y
< .5 THEN Y$
= "THROUGH THE HOLE INTO RIGHT FIELD" 1900 IF Y
< .25 THEN Y$
= "THROUGH THE HOLE INTO LEFT FIELD" 1910 PRINT "A SINGLE "; Y$;
"!" 1920 N = 1
1950 PRINT "INFIELDER UP WITH IT!" 1990 Y$ = "LEFT"
2000 IF Y
< .6 THEN Y$
= "CENTER" 2010 IF Y
< .3 THEN Y$
= "RIGHT" 2020 PRINT "FLY-OUT TO "; Y$;
" FIELD" 2050 Y$ = "CENTER"
2060 IF Z
< .6 THEN Y$
= "RIGHT" 2070 IF Z
< .3 THEN Y$
= "LEFT" 2080 PRINT "LONG FLY TO DEEP "; Y$;
" FIELD - LOOKS GOOD! " 2110 PRINT Y$;
"FIELDER CAUGHT IT AT THE WALL!" 2140 PRINT "A DIVING CATCH!" 2170 PRINT Y$;
"FIELDER CAUGHT IT ON THE WARNING TRACK!" 2180 O = O + 1
2240 B(I + 1) = B(I)
2250 B(I) = 0
2260 PRINT "LEAD RUNNER TAGS UP - AND ADVANCES 1 BASE!" 2300 PRINT "BATTER HOLDS WITH A SINGLE." 2310 N = 2
2330 B(2) = 0
2340 B(1) = 1
2400 N = 2
2430 N = 3
2450 B(3) = 0
2460 B(2) = 1
2500 N = 3
2530 PRINT "IT'S OVER THE WALL -- A H*O*M*E R*U*N!!!" 2540 N = 4
2580 PRINT "LINED OUT TO "; P$
(Y
) 2610 PRINT "BATTER BUNTS... " 2660 PRINT "THROWN OUT AT FIRST." 2670 O = O + 1
2690 IF B
(1) + B
(2) + B
(3) = 0 THEN 710 2700 PRINT "SACRIFICE - ";
2710 N = 1
2730 B(1) = 0
2770 PRINT "BATTER MISSES PITCH" 2790 PRINT "BEATS IT OUT! SINGLE!" 2800 N = 1
2850 PRINT "3 OUTS. THE SIDE IS RETIRED";
2860 I = B(1) + B(2) + B(3)
2890 IF I
> 1 THEN PRINT ", LEAVING "; I;
" MEN ON BASE" 2920 PRINT "*************" 2930 D
= T
/ 2 - INT(T
/ 2) 2970 Y$ = "INNINGS"
2980 IF T
< 3 THEN Y$
= "INNING" 2990 PRINT Y$;
" OF PLAY, THE SCORE IS" 3010 O = 0: B(1) = 0: B(2) = 0: B(3) = 0
3030 REM MY TEAM
IS AT BAT
3050 IF B
(1) + B
(2) + B
(3) = 0 THEN 3140 3320 PRINT "*** GOING INTO EXTRA INNINGS ***" 3350 PRINT "THE BALLGAME IS OVER." 3360 PRINT "*************" 3370 PRINT "FINAL SCORE:" 3380 T9 = 1
3410 PRINT "NICE TRY, "; B$
3420 PRINT "YOU SHOULD KNOW BETTER THAN TO TRY TO" 3430 PRINT "OUT-MANAGE A COMPUTER. MAYBE BASEBALL" 3440 PRINT "JUST ISN'T YOUR SPORT...WHY DON'T YOU TRY GOLF?" 3470 PRINT "CONGRATULATIONS, "; B$
3480 PRINT "YOU'VE BEATEN ME, BUT I WILL HAVE MY REVENGE." 3540 REM ADVANCE N BASES
(SET N BEFORE
GOSUB) 3550 N2 = B(1) + B(2) + B(3)
3570 N3 = N
3590 REM FIND LAST RUNNER: MAKE SURE HE ISN‘T TRYING
TO ADVANCE
3600 REM PAST HOME PLATE.
3640 IF 4 - I
< N
THEN N3
= 4 - I
3660 B(I) = B(I - N)
3680 B(N) = 1
3710 IF (N
- P
) > 1 THEN B
(N
- P
) = 0 3720 IF (N
- P
) <= 1 THEN B
(1) = 0 3790 Y$ = "RUNNERS ADVANCE "
3800 IF N2
= 1 THEN Y$
= "RUNNER ADVANCES " 3840 REM AT LEAST
1 RUN HAS SCORED.
3850 N2 = B(4) + B(5) + B(6) + B(7)
3870 R2 = R2 + N2
3890 R1 = R1 + N2
3900 B(4) = 0: B(5) = 0: B(6) = 0: B(7) = 0
3950 PRINT "******** NEW SCORE:" 4030 PRINT "*************" 4110 N = 1
4120 I = 4
4140 I = 3
4160 I = 2
4190 O = O + 1
4200 PRINT "BATTER THROWN OUT" 4220 B(I - 1) = 0
4250 O = O + 2
4260 PRINT "DOUBLE PLAY!" 4290 O = O + 1
4300 PRINT "RUNNER ON BASE "; I
- 1;
" IS OUT ON FIELDER'S CHOICE" 4340 REM FORCED RUNNERS ADVANCE
1 BASE, OTHERS HOLD
4380 N = 1
4420 B(I2) = 1
4450 REM LEAD RUNNER STEALS
4490 PRINT "NO ONE ON BASE, DUMMY!" 4540 IF B
(1) + B
(2) + B
(3) > 1 THEN 4570 4550 PRINT "RUNNER STEALS A BASE" 4570 PRINT "RUNNERS STEAL A BASE" 4580 N = 1
4590 C2 = C
4600 C = 4
4620 C = C2
4630 B(1) = 0
4680 PRINT "RUNNER THROWN OUT STEALING" 4690 O = O + 1
4700 B(I) = 0
4720 N = 1
4740 B(1) = 0
4800 REM RUNNERS ADVANCE ONE
BASE, BATTER THROWN
OUT 4810 N = 1
4840 B(1) = 0
4850 O = O + 1
4860 PRINT "BATTER THROWN OUT" 4880 PRINT "HIT BATSMAN (OUCH!)" 4910 N = 1
4930 B(1) = 0
4990 N = 1
5030 B(I0) = B(I0 - 1)
5050 B(1) = 1
5070 PRINT "WHEN YOUR'RE UP:" 5080 PRINT "1-BATTER TAKES PITCH" 5090 PRINT "2-BATTER SWINGS AWAY" 5100 PRINT "3-BATTER BUNTS" 5110 PRINT "4-LEAD RUNNER STEALS" 5140 REM PITCHING ROUTINE
5150 PRINT "YOUR PITCHER MAY THROW:" 5210 PRINT "6-KNUCKLEBALL" 5260 PRINT "WHAT WILL YOUR PITCHER THROW? ";
5330 PRINT "UH-UH, "; B$;
". ";
5390 W = 1
5510 IF B
(1) + B
(2) + B
(3) = 0 THEN 4490 5530 PRINT "HIT AND RUN!" 5540 C = 5
5560 DATA FAST BALL
,CURVE BALL
,SLIDER
,SINKER
,CHANGE
-UP
,KNUCKLEBALL
5580 DATA RIGHT
,LEFT
,CENTER
,FIRST
,SECOND
,THIRD
,SHORTSTOP
,PITCHER
,CATCHER
5590 DATA RIGHT OVER THE PLATE
,CAUGHT THE OUTSIDE CORNER
5600 DATA OVER THE INSIDE CORNER
,OVER AT THE KNEES
5610 DATA HIGH
,LOW
,INSIDE
,OUTSIDE
,HIGH
AND TIGHT
,LOW
AND OUTSIDE