Softball Statistics For Atari St
Roger Felton
"Softball Statistics" makes it easy to keep track of all the individual and team results for your favorite team. You can enter data for each player's times at bat, hits, runs, and so on. The program automatically computes batting averages, stores cumulative results on disk as the season progresses, generates formatted printouts with sorted rankings for all players, and more. The program was originally written for the eight-bit Atari and adapted for several other computers in the July 1985 issue of COMPUTE!. This new version runs in medium- or high-resolution modes on any Atari ST with the TOS operating in ROM. An 80-column printer is optional but recommended.
What's the worst position on a soft-ball team? Catchers have to squat in an uncomfortable stance for an hour or more and duck hazardous foul balls. Pitchers have to duel with mighty sluggers and dodge powerful line drives. First basemen have to stretch their bodies like rubber bands to nab wayward throws from their teammates while keeping at least one toe on the base bag. And outfielders have to scoop up bouncing grounders with the knowledge that no one is backing them up except the outfield fence.
But as demanding as all these positions are, there's another that could be worse—that of team statistician. Keeping track of your teammates' performance is often a laborious, thankless job. Sometimes the statistician is a reserve player or friend of the team who doesn't even get to play. Caged in the dugout, the statistician is supposed to document every hit, run, and walk, and boost team morale by contributing lively chatter. After the game, the statistician has to spend hours punching numbers into a calculator to figure out everyone else's batting average.
"Softball Statistics" makes that job much easier. After each game, the program prompts you to enter vital stats for each player. Then it automatically calculates the batting averages and prints sorted rankings on the screen or printer. It can also print sorted rankings for hits, runs, and runs batted in. These game statistics can then be merged with data for all previous games, and updated season results can be sorted by category and printed. Finally, the program lets you store the cumulative statistics on disk.
If you're a fan of professional or Little League baseball, you can use Softball Statistics to follow the fortunes of your favorite team. And with modifications, it could be adapted to a wide variety of sports.
Preparing The Program
Be extra careful when typing Softball Statistics because a mistyped line could yield inaccurate results even if the program runs without errors.Save a copy on disk for safekeeping before running it the first time.
Before using the program, you have to prepare it by entering your team's roster. Softball Statistics can handle a team with up to 20 players and stores this information in DATA statements as part of the program itself. If you're keeping stats for more than one team, you'll have to keep a separate copy of the program for each team.
The DATA statements for player information begin at line 2300. The statements must conform to a predefined format: a two-digit jersey number followed by a space, then the player's first or last name.
Precede one-digit jersey numbers with a zero, such as 08 for 8. Names car be any length, but only the first seven characters appear on the printouts. Each entry is separated by a comma. Example:
2300 DATA 23 LEE,17 JACKSON,33 JOHNSTON,10 LONGSTREET,04 PICKETT
(In the output, JOHNSTON and LONGSTREET would appear as JOHNSTO and LONGSTR.)
The programs are listed with dummy entries in the DATA statements, such as 44 Jim and 10 PLAYERX. Substitute your own team members for these entries. If your team has fewer than 20 players, leave the remaining dummy entries in the DATA statements but substitute the name PLAYERX; the program must have 20 entries to function, and it ignores the PLAYERX entries.
Finally, put your own team's name in the TM$ string statement at line 190. Softball Statistics is now ready to run.
Important note: You should avoid tinkering with the player name DATA statements once you've started using the program. Otherwise, there will be problems when it attempts to compute cumulative season totals. If you drop a player from the roster and replace him with another player, the new player's totals will contain the old player's results as well. To drop a player, substitute a PLAYERX dummy entry at that position in the DATA statement. Of course, this means the dropped player's results will no longer be included in the team totals for the season. If you wish to retain a dropped player's results in the team totals, leave the player's name in the DATA statement and enter 999 in response to all input prompts for that player's stats following subsequent games (see below).
Compiling Statistics
Once the roster is entered, you can run the program. It begins by asking for statistics for individual games. The first prompt asks:
Who did you play?Respond with the opposing team's name—such as Ham's Diner—and press RETURN. The next prompt reads:
Enter your score and their score (separated by a comma):
For instance, if your team lost by a score of 9 to 5, you'd type 5,9 and press RETURN.
The program now begins asking for individual player statistics. If the first player name on your roster is Kevin, the program prints
Kevin's statistics for this game:
and then prompts you, one by one, to enter the number of times at bat, runs scored, hits, runs batted in (RBIs), doubles, triples, home runs, and walks. At each prompt, type the appropriate number and press RETURN. After the last prompt, the program asks:
Is everything OK (Y/N)?
If you made any mistakes while entering the current player's stats, press N. You'll be given a chance to reenter the numbers.
When all the player's statistics are correct, press Y at the prompt. The program continues to the next player on the roster and repeats the cycle.
If a certain player missed a game, type 999 at the first prompt. This automatically enters zeros for all his stats and skips to the next player. In fact, entering 999 at any prompt inputs zeros for all of a player's remaining game stats.
Individual Printouts
After you type the last statistic for the last player, the program prints the message WORKING while it sorts all the data. (The WORKING message appears at other points in the program during sorts, since the sort routine is written in BASIC and is not particularly fast.) In a few moments, the program says:
Do you want a printout of the game's stats (Y/N)?
Type Y for yes or N for no. If you press N, the program asks if you want to input data for another game. If you press Y, it asks:
To screen or printer (S/P)?
Type S or P. Softball Statistics then prints the individual stats for all team members for that game, sorted in descending order by batting averages (see Figure 1). To pause the printout, press the left mouse button. You can resume after pausing by pressing the space bar.
Next, the program asks:
Do you want a sorted printout of hits, RBIs, and run leaders (Y/N)?
Again, type Y for yes or N for no. If you type N, the program asks if you want to input stats for another game. If you answer Y, it asks again if you want the output directed to the screen or printer, and then prints sorted rankings for the various slugging categories for that game (see Figure 2), As before, you can stop the output by pressing the left mouse button and restart it by pressing the space bar.
Finally, the program asks:
Do you want to input stats from another game (Y/N)?
Usually you type N at this prompt unless you're entering results of more than one game. If you type Y, the program repeats the entire process described above.
Season Totals
Softball Statistics makes it easy for you to tabulate running totals for the entire season by storing game results on disk. After you've entered and viewed the stats for the most recent game, the program asks:
Would you like to merge in data for the year (Y/N)?
The first time you run Softball Statistics, of course, you won't have any previous data on disk, so you'd answer N, skipping to the next prompt. During subsequent runs, you'd answer Y to merge in data for the year. The program then requests a filename for the disk data file and merges these existing stats with the results you've entered for the latest game or games.
Season totals are then computed automatically, and the program asks:
Do you want a printout of the year's stats (Y/N)?
If you answer Y, the program asks if you want output directed to the screen or printer, and then prints season totals for all players. This printout includes the team's win-loss record and sorts players in descending order by batting averages (see Figure 3).
Afterward, the program asks if you want sorted printouts for hits, RBIs, and runs—again, based on season totals (these charts resemble those in Figure 2). Finally, the program gives you the opportunity to save the updated data file on disk until the next game.
If you typed N after the previous prompt, the program asks:
Do you want to save the data (Y/N)?
If you answer Y, the program asks for a filename for the updated data file, saves the file, and then ends.
Softball Computing
If you're interested in programming, you can learn a lot by studying Softball Statistics because it's written in straight BASIC with no machine language. In fact, the input and output routines beginning at lines 2350 and 2470 are general enough to be adapted to your own programs.
You don't have to be a programmer, though, to appreciate Softball Statistics. If you're a softball statistician, no longer do you have the worst position on the team. Maybe it's the shortstop.