Virtual Moneyball: A Baseball League Simulator  
line decor
  
line decor
 
 
 
 

 
 
A Detailed Guide to Virtual Moneyball    

Purpose
The purpose of this document is to provide information regarding the installation, execution, and general expectations of the Virtual Moneyball simulator program. 

Hook Up and Install
I.  The program is entirely software based, as such there are no physical components to assemble, attach, or general insert into the simulator. 

II.  The program can be installed via two methods: CD-ROM or download.  If the download method is preferred, the simulator can be acquired from http://compsci.snc.edu/~kroera/VirtualMoneyball/setup.exe, which will download the base-level installer.  If the CD-ROM method is preferred, simply run setup.exe to begin the install. 

III.  Upon execution, the installer first checks to make sure the local machine has the required components to run the program, including the .NET 3.5 SP1 Framework, a handful of DLLs, and the Crystal Reports runtime environment. 

IV.  If the computer lacks a certain required component, the installer will automatically download it from Microsoft (.NET), a third-party site such as Business Objects (Crystal Reports), or from the DLL repository found at http://compsci.snc.edu/~kroera/VirtualMoneyball/. 

V.  Once all required prerequisites are installed, the installer will download the rest of the program files from http://compsci.snc.edu/~kroera/VirtualMoneyball/. 

VI.  Upon successful download and installation of the required program files, the simulator will automatically startup.  Following this initial run, the program can be reopened via the Start menu at Programs ->St. Norbert College ->CS460 Capstone Projects->Virtual Moneyball Simulator. 

VII.  Any future updates to the program can be acquired by simply re-downloading the program from http://compsci.snc.edu/~kroera/VirtualMoneyball/setup.exe.  The program will be updated without having to uninstall any previous versions or re-installing previously acquired prerequisite programs.  Only newly updated application components will be installed. 
 
Compile and Link
I.  Once the simulator is installed, the program can be launched via the Start Menu as a self-contained program.  The installer assures that all required libraries have been installed on the local machine, so unless an error occurred to install, there should be no issue in linking the program prior to execution. 

II.  The program also needs to connect to its locally installed database, which should pose little trouble so long as data integrity remains. 

III.  Overall, compiling and linking is handled ahead of time by the install process, so as long as the program files and folders are not physically modified and the database remains uncorrupted, there should be no trouble with this step in the process. 

Initialization
I.  The program begins by initializing an instance of the BaseballSimulation class, which inherits from the Form class.  BaseballSimulation serves as the parent class for all other forms in the program. 

II.  Initialization of the BaseballSimulation class asserts that the local database exists, and establishes TableAdapter objects for each table in the database.  These objects allow queries to be run on the various tables without the use of messy in-code SQL commands, and by initializing them in the parent class, it gives each child access to said functions without having to re-declare the adapters.  

III.  BaseballSimulation also initializes a DataSet object, which maps to the local database as a whole.  Primarily, this variable is used to send Commit/Update commands to the physical database when changes are made via TableAdapter queries.  The DataSet object also provides access to DataTable objects with the same name as the physical tables in the database, which can then be sent to Crystal Reports as a source for running its reports. 
           
IV.  Four inheritable functions are also created with the BaseballSimulation class, including an event handler to automatically highlight all text in a TextBox when the user enters the component, a handler that sorts the contents of a ListView by whatever column header is clicked by the user, a function that sends back a bool variable indicating whether or not a given league has completed drafting all required players, and a function to create a hashed password for a given user. 

V.  Once initialization of the BaseballSimulation class is complete, the program launches welcomeForm.cs and user interaction begins. 

Using the Simulator
The following section should be read as a detailed guide to the program for the average user, as such it is worded for the non-Computer Science individual.  For information about the inner workings of the code itself, please download the source files for the latest release and view the internal program documentation:

I.  Upon starting the program, you will be presented with a form prompting you to enter a username and password to access the system.  If you do not currently have a username, click the middle button on the form to create one

screenshot1

II.  Fill out the form that appears in order to establish a username and password.  Click the “Create New User” button and a pop-up will confirm your new login.  Please note, both username and password are case sensitive, and while usernames only need at least one non-space character, passwords must be a minimum length of six characters, not counting leading or trailing spaces. 

screenshot2

III.  Enter your new account information to log into the system.

IV.  At the next screen, you will be prompted to select a league to use.  If you have yet to create a league, please click the “Create New League” button to set one up.

screenshot3

V.  Once again, fill out the form that appears to create a league.  All fields on the screen are required, as they will establish the league name, number of teams in the league, number of batters and pitchers per league, the number of times each time will play every other team in a season, and the salary cap.  Please note that “None” is an available option in setting the league salary cap.  Once all fields have been selected, click “Create League” to continue. 

screenshot4

VI.  Once the league has been created, it will be available on the league select screen.  Simple click on the name of the league, then click “Start or Continue Selected League” to continue. 

VII.  Upon first starting the league, you will be prompted to setup each team in your league via a team setup window. 

screenshot5

VIII.  To setup a team, simply enter a name for the team and choose the criteria by which a team will select batters and pitchers.  Please note that your team, the first team the program will prompt you to setup, only requires a name, as you will manually select your players. 

IX.  Once each team in your league has been setup, the program will request that you setup the league statistical weights.  From this screen, simply use the slider bars to select how valuable each given statistic is on a per game basis.  For example, if your team on average hits 10 singles per game and the run value of singles is set to 0.20, each single is worth 0.20 runs, and thus 2 runs will be generated by your team on average from singles. 

screenshot6

X.  Once a value has been selected for all statistics you would like to be applicable in the league, simply click “Save Changes and Exit” to continue.  If you wish to reset your values, click the appropriate “Reset” button to set every statistical weight to zero.  If you wish to exit the screen without saving any changes, click the “Cancel” button to do so, although in order to begin using a league, statistical weights will need to be set at a later time. 

XI.  With both teams and statistical weights for the league established, the Main Menu screen of the program will become available.  From the Main Menu, six options are available, each of which is detailed below:

            Draft/Re-Draft League
            a.  In order to simulate a season, add/drop players, and run certain reports, each team in the league must contain a full roster of players.  Click this button to draft players and fill team rosters. 

screenshot7

            b.  At the draft screen, four windows will display.  The top two windows will display players currently on your team, while the bottom two windows will display all available players.  Status messages above each top window will display which batter or pitcher you are currently drafting out of how many are required on each team. 

            c.  To draft a player, simply locate the individual in the available players list, which can be sorted by a wide variety of statistics by clicking on the appropriate column headers.  Click the player’s name, followed by “Add Selected Batter/Pitcher”.  Assuming the player fits under your salary cap, he will be added to your team, followed by each computer-controlled team selecting a player at that same position for their team.
 
            d.  Continue selecting and adding batters and pitchers until both positions are full, followed by clicking the “Save and Exit” button to return to the main menu. 

            e.  If at any point you wish to exit the draft before it completes, you may click “Save and Exit” to do so; however you will need to finish drafting in order to simulate games with the league.  Simply re-enter the draft screen to continue where you left off. 

            f.  The draft screen may be re-entered at any point while using the program.  Most importantly, if you re-enter the screen after teams have been filled with a full roster of players, the program will give you the option of clearing all rosters and re-drafting the league from scratch. 

screenshot8

            Simulate Season and Advance to Next
            a.  From the Main Menu, select this option to begin simulating seasons for your league. 

screenshot9

            b.  A screen will appear giving you three options: simulating a season, going to the reporting menu, or returning to the Main Menu. 

            c.  To simulate a season, simply click the “Simulate” button.  The program will run through the necessary calculations to generate results for your league, and should provide updates on the window itself as to how many games are remaining to be simulated in the given season. 

            d.  A pop-up will confirm that the given season for your league has been simulated.  The league’s current season will also be advanced by one “year”. 

            e.  You may simulate as many seasons as you would like.  To return to the Main Menu or open the reporting screen to view the results of your simulations, simply click the appropriate button. 

            Edit Statistical Weights
            a.  From the Main Menu, select the “Edit Statistical” weights option if you wish to change the weights of each performance statistic of the league. 

            b.  The same screen from league setup, consisting of slider bars and save/cancel/reset buttons, will appear and functions the same as before.  Please consult the earlier section in this guide for use of this screen. 

            c.  Once you have completed your changes or wish to cancel your changes, click the appropriate button to return to the Main Menu. 

            Add/Remove Players from Your Team
            a.  After initially drafting players from your team, select this option if you would like to swap any players on your team for any available (non-drafted) players. 

screenshot10
           
            b.  The screen should resemble the draft screen, with the two top windows displaying players currently on your team and the bottom two displaying all available players. 

            c.  To add a “free agent”, you must also drop a player from your team at that position.  Therefore, to process the transaction, locate and select both the player you wish to add to your team and the player you wish to drop from the appropriate windows. 

            d.  Once both players are selected, click the “Swap Selected Batter/Pitcher” button to make the switch.  If adding the new player will put your team over the league salary cap, the transaction will be denied.  Otherwise, the swap will be made and the new player should appear in your current roster window. 

            e.  You may swap as many players as you would like, simply click the “Save and Exit” button when complete to return to the Main Menu. 

            f.  Please note that computer-controlled teams do not add/drop players.  If you wish to change the rosters of these teams, you must re-draft the entire league. 

            Generate Reports
            a.  Select this option if you wish to view various statistics or facts about your league.

screenshot11
            b.  The screen that appears will give you the option of selecting a report that will display in the bottom half of the window, along with any filtering options available to that report.  Select the desired report along with any required filters and click the “Run” button. 

            c.  The selected report will display in the bottom half of the window.  From the bar that divides the two halves of the window, you may choose to export the report to a PDF document, and Excel spreadsheet, a Word document, or a Rich Text file.  The Excel option is recommended if you wish to do any additional calculations with the data. 

            d.  You may also print the report, zoom in/out, or scroll the various pages of the report by using the appropriate buttons on this bar. 

            e.  The various reports that are available to run are described below:

            Basic League Details – Displays your league’s name, salary cap, number of batters and pitchers per team, and the names of each team in your league along with their selected draft options.

            Game-by-Game Results – Displays the scores of each game from your league along with the two teams that played in the game.  Requires that you select a season for which to view results. 

            Statistical Weights for Your League – Displays the value/weight associated with each performance statistic in your league.  If you choose to alter these weights between seasons, the changes will display in this report.  Requires that you choose a season for which to view weights. 

            Team Batting/Pitching Rosters – Displays each batter or pitcher on a team, along with all appropriate performance statistics for that player.  Please note that individual statistics do not change from season-to-season,  they simply contribute to a team’s average performance.  Both reports require a team roster to display, along with which season’s roster to generate. 

            Team Records – Displays the game-by-game results for a given team in a given season.  The report will indicate whether the team played a home or away game and the score of that game.  Furthermore, the report will show the team’s current record at that point in the season as a result of the game on the same line.  Requires both a team and season for which to display results. 

            f.  Please note that for each report requiring a team or season, select the “All” option to display data for all teams and/or all seasons that the league has currently simulated. 

            Logout and Select a New League
            a.  If you are finished working with your league, click this button to return to the league select screen. 

            b. From this screen, you may select a new league to work with, or continue exiting the program back to the user login screen, then simply exit the program altogether. 

Known Exceptions
I.  If the program crashes during the simulation of a season, or the user forces an exit, the given season will need to be re-simulated and pre-existing game result data from that season will be lost. 

II.  Once a user establishes names and draft philosophies for each team in the league, they cannot be changed, a user must create a new league in order to have a new crop of teams with different management styles. 

III.  Team names can be duplicated within a league, which could cause some confusion with the user. 

IV.  The user can use non-alphanumeric characters in textboxes, which could cause problems in certain instances.

V.  If the user does not have access to the Internet, the program cannot be installed as it will not be able to download the Crystal Reports runtime environment or retrieve the required libraries for the program. 

VI.  If the database is somehow corrupted, the entire program will fail to run and the user will need to uninstall and re-download the program. 

Hints for Operation
I.  When simulating league seasons, it is best to simulate many seasons at one time, as team statistical averages are calculated once when the window is opened and then reused.  If the window is closed and reopened to simulate additional seasons, the program must assume that the rosters, and therefore the statistical averages, of one or more teams has been altered and thus must be recalculated.  As these calculations can take a decent amount of time, simulate multiple seasons in one go, and only exit the simulation window if players are going to be added or dropped from a team or the league is going to redraft. 

II.  Give leagues meaningful names, perhaps including the number of teams or the general draft philosophies of the teams in the league.  This data can also be pulled from the “Basic League Details” report. 

III.  When generating reports, generate for the widest parameters possible: all teams and/or all seasons.  As this data can be exported to Excel and parsed from there, it is perhaps beneficial to start with a wide range of data and manually extract the desired subset. 

IV.  One does not have to finish setting up a league in one sitting, the program can be exited while naming teams or setting statistical weights.  When the user restarts the program, they can finish these two portions where they left off. 

V.  The ListView windows containing available players and selected players resort after every round of the draft or after every swap on the waiver wire, so remember this fact if one is selecting players by utilizing the column sort feature of the window. 

 

 

Required Reading

Moneyball
by Michael Lewis


The Mythical Man-Month
by Fred Brooks