Classic Computer Magazine Archive ANTIC VOL. 6, NO. 12 / APRIL 1988

Feature Application

Ballpark Figures

Batting out baseball statistics with Atari

Whether you're a little league coach, a softball league player or just an armchair manager, sooner or later you'll need to compile statistics for your team. Now Antic's Ballpark Figures takes the tedium out of this task. This BASIC program works on all 8-bit Atari computers. A disk drive is required.

Baseball is a game of statistics, so the saying goes. Certainly "America's national sport," with its lengthy playing season, seems to generate more numerical analysis than the other major categories of professional athletics.

So no matter if you're just a serious fan, a softball league participant, or a little league manager, sooner or later you are going to want to compile some statistics for your favorite team. Done by hand in the traditional manner, it's tedious at best to pore over the team scorebook and churn out those seemingly endless statistical calculations throughout the season.

But when it comes to number-crunching, your trusty Atari can easily do all the dirty work. Now with Ballpark Figures software, you quickly enter information direct from your team's scorebook, selecting categories by simply choosing from a menu. The program automatically accumulates and calculates such statistics as batting average (BA), slugging percentage (SP) and on-base percentage (OBP) for up to 45 players on your team. The data can then be printed neatly on your Epson-compatible printer or saved to disk.

Ballpark Figures screen


With Ballpark Figures, you'll be able to hand your teammates statistical printouts that are sure to make you a hit. Type in Listing 1, BALLPARK.BAS, check it with TYPO II and SAVE a copy before you RUN it.

If you have trouble typing in the special characters in lines 1072-1074, don't type them in. Listing 2 will create them for you. Type Listing 2, check it with TYPO II, and SAVE a copy to disk. When RUN, Listing 2 creates these hard-to-type lines, and stores them in a disk file called D:LINES.LST.

To merge the two programs, LOAD "D:BALLPARK.BAS" and then ENTER "D:LINES.LST" - remember to SAVE the completed program before you RUN it.

When RUN, Ballpark Figures will load the sort routine, originally by Adrian Dery from the October/November 1982 Antic. The program will then present four numbered options-Print, Save File, Load File or Enter A Game.

Press [4] to enter a game. You do not need to press [RETURN]. The program will ask if this is the first game entered for this team. If so, you'll go directly to the lineup entry routine. If not, you'll be asked for the name of the team file that you want to work on. Enter the filename and press [RETURN] to LOAD the file.

Now you're ready to enter the starting lineup. Up to 15 players can be in the starting lineup. Enter the numbers of the starters in the order that they batted. You must enter numbers-such as uniform numbers-not names. If necessary, assign made-up numbers.

To avoid problems with misspelled names, etc., the program identifies players by number. Players' names are only asked for in game entry mode and whenever a player is found who is not yet in the team file. After entering the lineup, you'll go into game-entry mode. A large menu is displayed onscreen. You'll also see the current inning number plus the current player's name, number and position in the batting order.

To record a player's appearance at bat, select items from the menu based on what the batter did. For example, if he singled with runners on base, drove in a run, stole a base and scored, you would select:

N-Men on base
K-RBI (runs batted in) and enter 1
L-Attempted steal-and enter Y for a successful steal
M-Scored a run

Then select option 0 to go to the next batter. It's that simple.

You can choose menu options either by entering the letter of an option or moving the cursor up or down with the [ARROW] keys without pressing [CONTROL]). An asterisk appears next to each selected option to help you keep track of what you've entered. If you make a mistake, select option T to redo the current batter. To select FC (base reached on fielder's choice) or strikeouts, you need to press [CONTROL] along with G or H. When you re done, select Q to return to the main menu.


Most game entry options will be self-explanatory to any baseball fan, but a few comments are in order:

For RBIs, option K, the program prompts you to enter the number of RBIs (1-4), or a G (to indicate a game-winning RBI). You must press G before the number of RBIs if it is the game-winner. And, naturally, you can only enter one game-winning RBI per game.

The only difference between option O, Next Batter, and option P, Next Inning, is that P increments the inning number and O doesn't-this is just to help you keep track of your place in the scorebook. So if you accidently select O instead of P at the end of an inning, don't panic. Simply select P after the next batter.

Option R allows you to make a substitution for the cur rent batter. The program asks you to enter the number of the new player (and his name if he's not in the team file). It then returns you to the game menu with the new player's number and name at the top of the screen. You can now enter the plate appearance. To put in a pinch-runner, first enter the manner in which the batter reached base and then make the substitution. Now the pinch-runner will be credited for stolen bases or scoring a run, and the batter will be credited with the base hit, walk, etc.

Option S, Append Lineup, adds players to the end of the batting order so you to can handle those situations where you need to add players that show up after the game has started. This might happen in an impromptu softball game, for instance.

The program will not let you enter impossible events such as a single and a double in the same time at bat. It also "knows" when to select certain options automatically. For example, if you enter Option D, Home Run, the program will select Options M, Scored, and K, RBIs, if you haven't already selected them yourself.


You can save the team file to disk with option 2, or print an alphabetized statistics sheet. The printout option asks for a team name and a date to be printed at the top of the page.

Ballpark Figures was designed to work with Epson-compatible printers. If you're using another type of printer, edit line 211 and change:


to the code(s) which put your printer into condensed mode (17 characters per inch). If you own a Genicom 3024-II printer, for example, you'd change line 211 to:


because that's the printer code that puts the Genicom 3024-Il into condensed mode.

The statistical headings for Ballpark Figures are as follows:

AB   Offical at-bats
AVG   Batting average
WMO   Batting average with men on base
SP   Slugging percentage
OBP   On base percentage
SF   Sacrifice flies
SH   Sacrifice hits (bunts)
H   Hits
2B   Doubles
3B   Triples
HR   Home runs
RBI   Runs batted in
GW   Game-winning RBI
BB   Bases on balls (walks)
R   Runs scored
SB   Stolen bases
SBA   Stolen base attempts
SO   Strikeouts
GIDP   Number of times the player grounded into a double play.

Obviously, the statistics generated by this program will only be as complete and accurate as the raw data in your scorebook. To fully utilize the features of this program, you will have to record such things as when substitutions were made, etc., while keeping score And be sure to notice whether or not there were men on base when entering the data into the computer.

Here are the formulas and explanations for some common baseball statistics:

AVG     H/AB
SP     (H+2B+(2*3B)+(3*HR))/AB
OBP     (H + BB + HBP)/(AB + BB + HBP + SF + SH)
HBP     Hit by pitch
GW     The RBI that gave the winning team the lead it never relinquished. Not every game necessarily has a GW.

Serious baseball statisticians will want to know that WMO in this program actually measures hits per plate appearance with runners on base, as opposed to hits per at-bat with runners on base.

This is the second Antic appearance by Edward Brown of Indianapolis. His first was Ave Maria, a musical microscreen that was the December 1984 disk bonus.

Listing 1: BALLPARK.BAS Download