It’s officially baseball season!

Phillies @ Pirates – 1:05 P.M.

This was a nice game and a great start to the 2009 season for the Pirates.  Shelby Ford hit a 3-run home run in his first MLB outing.  The Pirates threw nine different pitchers in the game.  The “Mad Capper,” Matt Capps struggled in the second inning when he walked the bases loaded on 12 pitches.  Still, he escaped with a scoreless inning.  

I scored this game using FixedIt.  Here is the completed scorecard.  There are a lot of aspects of this program that I really enjoy, but other aspects can be frustrating.  I’ve found that you need to be very careful when entering substitutions, as it is very difficult to undo mistakes.

I plan to experiment with several different scoring methods throughout Spring Training, but I plan to stick with Project Scoresheet once the regular season begins.

I’ve got a big update today.  Roster files (.ROS and FixedIt .CSV) are now updated for all Minor League Baseball teams on a daily basis from http://www.milb.com.  Thanks to Daniel Stenberg and the curl-and-php mailing list for the tip on using LiveHttpHeaders to get this accomplished.

If you click on “Roster Files,” you’ll notice that there are now subpages for AAA, AA, A+, A-, A, and Rookie.

Roster files for all teams are included within those pages.

Enjoy!

Retrosheet game files use a code to represent each Major League Baseball stadium.  Here is the legend for those codes.

Ballpark Codes

And because I think this blog needs some color… here is PIT08.

pncpark

To analyze output from the bevent program, it helps to input the data into a database.  I prefer to use MySQL.  Here’s how.

1) Create a database table.

CREATE TABLE `bevent` (
`gameid` varchar(12) NOT NULL,
`vteam` varchar(3) NOT NULL,
`inning` int(3) NOT NULL,
`battingteam` int(1) NOT NULL,
`outs` int(1) NOT NULL,
`balls` int(1) NOT NULL,
`strikes` int(1) NOT NULL,
`pitchsequence` varchar(25) NOT NULL,
`vscore` int(2) NOT NULL,
`hscore` int(2) NOT NULL,
`batter` varchar(10) NOT NULL,
`batterhand` varchar(2) NOT NULL,
`resbatter` varchar(10) NOT NULL,
`resbatterhand` varchar(2) NOT NULL,
`pitcher` varchar(10) NOT NULL,
`pitcherhand` varchar(2) NOT NULL,
`respitcher` varchar(10) NOT NULL,
`respitcherhand` varchar(2) NOT NULL,
`catcher` varchar(10) NOT NULL,
`firstbase` varchar(10) NOT NULL,
`secondbase` varchar(10) NOT NULL,
`thirdbase` varchar(10) NOT NULL,
`shortstop` varchar(10) NOT NULL,
`leftfield` varchar(10) NOT NULL,
`centerfield` varchar(10) NOT NULL,
`rightfield` varchar(10) NOT NULL,
`firstrunner` varchar(10) NOT NULL,
`secondrunner` varchar(10) NOT NULL,
`thirdrunner` varchar(10) NOT NULL,
`eventtext` varchar(30) NOT NULL,
`leadoff` varchar(1) NOT NULL,
`pinchhit` varchar(1) NOT NULL,
`defensiveposition` int(2) NOT NULL,
`lineupposition` int(2) NOT NULL,
`eventtype` int(4) NOT NULL,
`battereventflag` varchar(1) NOT NULL,
`abflag` varchar(1) NOT NULL,
`hitvalue` int(1) NOT NULL,
`shflag` varchar(1) NOT NULL,
`sfflag` varchar(1) NOT NULL,
`outsonplay` int(1) NOT NULL,
`doubleplayflag` varchar(1) NOT NULL,
`tripleplayflag` varchar(1) NOT NULL,
`rbionplay` int(1) NOT NULL,
`wildpitchflag` varchar(1) NOT NULL,
`passedballflag` varchar(1) NOT NULL,
`fieldedby` int(2) NOT NULL,
`battedballtype` varchar(2) NOT NULL,
`buntflag` varchar(1) NOT NULL,
`foulflag` varchar(1) NOT NULL,
`hitlocation` varchar(5) NOT NULL,
`numerrors` int(1) NOT NULL,
`firsterror` int(1) NOT NULL,
`firsterrortype` varchar(2) NOT NULL,
`seconderror` int(1) NOT NULL,
`seconderrortype` varchar(2) NOT NULL,
`thirderror` int(1) NOT NULL,
`thirderrortype` varchar(2) NOT NULL,
`batterdest` int(2) NOT NULL,
`firstdest` int(2) NOT NULL,
`seconddest` int(2) NOT NULL,
`thirddest` int(2) NOT NULL,
`playonbatter` varchar(8) NOT NULL,
`playonfirst` varchar(8) NOT NULL,
`playonsecond` varchar(8) NOT NULL,
`playonthird` varchar(8) NOT NULL,
`sbfirst` varchar(1) NOT NULL,
`sbsecond` varchar(1) NOT NULL,
`sbthird` varchar(1) NOT NULL,
`csfirst` varchar(1) NOT NULL,
`cssecond` varchar(1) NOT NULL,
`csthird` varchar(1) NOT NULL,
`pofirst` varchar(1) NOT NULL,
`posecond` varchar(1) NOT NULL,
`pothird` varchar(1) NOT NULL,
`respfirst` varchar(10) NOT NULL,
`respsecond` varchar(10) NOT NULL,
`respthird` varchar(10) NOT NULL,
`newgame` varchar(1) NOT NULL,
`endgame` varchar(1) NOT NULL,
`pinchfirst` varchar(1) NOT NULL,
`pinchsecond` varchar(1) NOT NULL,
`pinchthird` varchar(1) NOT NULL,
`removefirst` varchar(10) NOT NULL,
`removesecond` varchar(10) NOT NULL,
`removethird` varchar(10) NOT NULL,
`removebatter` varchar(10) NOT NULL,
`removebatterpos` int(2) NOT NULL,
`fielder1` int(2) NOT NULL,
`fielder2` int(2) NOT NULL,
`fielder3` int(2) NOT NULL,
`assist1` int(2) NOT NULL,
`assist2` int(2) NOT NULL,
`assist3` int(2) NOT NULL,
`assist4` int(2) NOT NULL,
`assist5` int(2) NOT NULL,
`eventnum` int(4) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

2. Download the Retrosheet zip files, and run the beventprogram.  If you setup your database with fields 0-96, make sure you output all fields with bevent.

bevent -y 2008 -f 0-96 2008ANA.EVA 2008BAL.EVA 2008CHA.EVA 2008DET.EVA 2008OAK.EVA 2008SEA.EVA 2008TBA.EVA 2008TOR.EVA 2008ARI.EVN 2008ATL.EVN 2008CHN.EVN 2008CIN.EVN 2008COL.EVN 2008FLO.EVN 2008HOU.EVN 2008LAN.EVN 2008MIL.EVN 2008NYN.EVN 2008PHI.EVN 2008SDN.EVN 2008SFN.EVN 2008SLN.EVN 2008WAS.EVN 2008BOS.EVA 2008CLE.EVA 2008KCA.EVA 2008MIN.EVA 2008PIT.EVN > 2008COMBINED.csv

3. Import 2008COMBINED.csv into your new MySQL database table.

To analyze output from the bgame program, it helps to input the data into a database.  I prefer to use MySQL.  Here’s how.

1) Create a database table.

CREATE TABLE `bgame` (
`gameid` varchar(12) NOT NULL,
`gamedate` varchar(8) NOT NULL,
`gamenumber` int(1) NOT NULL,
`dayofweek` varchar(10) NOT NULL,
`starttime` int(8) NOT NULL,
`dhused` varchar(1) NOT NULL,
`daynight` varchar(1) NOT NULL,
`vteam` varchar(3) NOT NULL,
`hteam` varchar(3) NOT NULL,
`gamesite` varchar(3) NOT NULL,
`vstartingpitcher` varchar(10) NOT NULL,
`hstartingpitcher` varchar(10) NOT NULL,
`humpire` varchar(10) NOT NULL,
`fumpire` varchar(10) NOT NULL,
`sumpire` varchar(10) NOT NULL,
`tumpire` varchar(10) NOT NULL,
`lfumpire` varchar(10) NOT NULL,
`rfumpire` varchar(10) NOT NULL,
`attendance` int(8) NOT NULL,
`psscorer` varchar(25) NOT NULL,
`translator` varchar(25) NOT NULL,
`inputter` varchar(25) NOT NULL,
`inputtime` varchar(15) NOT NULL,
`edittime` varchar(15) NOT NULL,
`howscored` int(8) NOT NULL,
`pitchesentered` int(8) NOT NULL,
`temperature` int(3) NOT NULL,
`winddirection` int(8) NOT NULL,
`windspeed` int(8) NOT NULL,
`fieldcondition` int(8) NOT NULL,
`precipitation` int(8) NOT NULL,
`sky` int(8) NOT NULL,
`timeofgame` int(8) NOT NULL,
`numberofinnings` int(8) NOT NULL,
`vfinalscore` int(8) NOT NULL,
`hfinalscore` int(8) NOT NULL,
`vhits` int(8) NOT NULL,
`hits` int(8) NOT NULL,
`verrors` int(8) NOT NULL,
`herrors` int(8) NOT NULL,
`vlob` int(8) NOT NULL,
`hlob` int(8) NOT NULL,
`wpitcher` varchar(10) NOT NULL,
`lpitcher` varchar(10) NOT NULL,
`spitcher` varchar(10) NOT NULL,
`gwrbi` varchar(10) NOT NULL,
`vbat1` varchar(10) NOT NULL,
`vpos1` int(3) NOT NULL,
`vbat2` varchar(10) NOT NULL,
`vpos2` int(3) NOT NULL,
`vbat3` varchar(10) NOT NULL,
`vpos3` int(3) NOT NULL,
`vbat4` varchar(10) NOT NULL,
`vpos4` int(3) NOT NULL,
`vbat5` varchar(10) NOT NULL,
`vpos5` int(3) NOT NULL,
`vbat6` varchar(10) NOT NULL,
`vpos6` int(3) NOT NULL,
`vbat7` varchar(10) NOT NULL,
`vpos7` int(3) NOT NULL,
`vbat8` varchar(10) NOT NULL,
`vpos8` int(3) NOT NULL,
`vbat9` varchar(10) NOT NULL,
`vpos9` int(3) NOT NULL,
`hbat1` varchar(10) NOT NULL,
`hpos1` int(3) NOT NULL,
`hbat2` varchar(10) NOT NULL,
`hpos2` int(3) NOT NULL,
`hbat3` varchar(10) NOT NULL,
`hpos3` int(3) NOT NULL,
`hbat4` varchar(10) NOT NULL,
`hpos4` int(3) NOT NULL,
`hbat5` varchar(10) NOT NULL,
`hpos5` int(3) NOT NULL,
`hbat6` varchar(10) NOT NULL,
`hpos6` int(3) NOT NULL,
`hbat7` varchar(10) NOT NULL,
`hpos7` int(3) NOT NULL,
`hbat8` varchar(10) NOT NULL,
`hpos8` int(3) NOT NULL,
`hbat9` varchar(10) NOT NULL,
`hpos9` int(3) NOT NULL,
`vfinisher` varchar(10) NOT NULL,
`hfinisher` varchar(10) NOT NULL,
PRIMARY KEY  (`gameid`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

2. Download the Retrosheet zip files, and run the bgame program.

bgame -y 2008 2008ANA.EVA 2008BAL.EVA 2008CHA.EVA 2008DET.EVA 2008OAK.EVA 2008SEA.EVA 2008TBA.EVA 2008TOR.EVA 2008ARI.EVN 2008ATL.EVN 2008CHN.EVN 2008CIN.EVN 2008COL.EVN 2008FLO.EVN 2008HOU.EVN 2008LAN.EVN 2008MIL.EVN 2008NYN.EVN 2008PHI.EVN 2008SDN.EVN 2008SFN.EVN 2008SLN.EVN 2008WAS.EVN 2008BOS.EVA 2008CLE.EVA 2008KCA.EVA 2008MIN.EVA 2008PIT.EVN > 2008COMBINED.csv

3. Import 2008COMBINED.csv into your new MySQL database table.

Recently, when I’ve been scoring baseball games, I’ve preferred to use the Project Scoresheet notation.  Like just about any scoring system, Project Scoresheet has its pros and cons, but I like the way that score cards in this notation can be easily input and analyzed by a computer.  The tradeoff is that it can be difficult, at times, to look at the score card and get a quick idea of the current state of the game.  At first, the notation can be a bit difficult to learn, but once you get the hang of it, you can score games quite efficiently.

I won’t even try to do as good (or as thorough) of a job describing this scoring notation as Alex Reisner.  Check out his description of Project Scoresheet and example score card here.  Alex Reisner’s Introduction to Project Scoresheet Scoring (PDF)Alex Reisner’s Project Scoresheet score card (PDF). Also,  check out his website at http://alexreisner.com/baseball.  He has some pretty interesting scorecards and player performance graphs on there. 

To give a quick overview: a Project Scoresheet score card has three lines for each at-bat.  The top line is for anything that happened “before the play” (stolen bases, wild pitches, passed balls).  The middle line is for what happened during the play itself (single, double, strike out, ground out, etc.).  The bottom line is for the actions following the play (base runner advancements).

All on-field actions are abbreviated by short codes.

Single, Double, Triple, Home Run, Strikeout = S, D, T, HR, K

To code outs where the ball was put into play, you record the fielders who touched the ball.

A flyout to center = 8/F

A groundout to the shortstop = 63/G

Again, the main advantage to this type of scoring is that the score card can quickly be entered into a computer for analysis.  All of the game files at http://www.retrosheet.org use this notation.