WOLFRAM|DEMONSTRATIONS PROJECT

Baseball without Swings

​
percent of visitor pitches that are strikes
0.5
percent of home pitches that are strikes
0.5
balls per walk
1
2
3
4
5
6
strikes per strikeout
1
2
3
4
5
6
outs per inning
1
2
3
4
5
6
innings per game
9
random seed
game time controls
empirical win estimation controls
Inning
1
2
3
4
5
6
7
8
9
Total
Visitors
0
4
0
0
0
0
0
0
0
4
Home
3
0
0
0
0
0
0
0
0
3
Item
Visitors
Home
estimated winning percentage
0.616
0.384
pitches
218
205
strikes
106
101
balls
112
104
actual strike percentage
0.486
0.493
runs per game
4.
3.
runs per innings
0.444
0.333
runs per nine innings
4.
3.
std. dev. of runs per inning
1.33
1.
std. dev. of runs per nine innings
4.
3.
estimated game time (in minutes): 149
Consider a game modeled after American baseball that involves a "state" that will be altered in a complex way by a sequence of "pitches" that are randomly either a "strike" or a "ball" according to a user-specified ratio. The "state" of the game is an inning integer, an out integer, a run integer, a "line score" substate, a count substate, or a three-element base occupation substate. At the start of the game, the state is {1,0,0,{},{0,0},{False,False,False}}.
After each pitch, one examines and modifies the state of the game. In Stage 1 of this examination, when a strike is encountered, the second element of the count substate is incremented. When a ball is encountered, the first element of the count substate is incremented. The state is then examined. If the second element of the count is equal to a user-specified value (traditionally 3), the out component of the state is incremented and the count substate is reset to {0,0}. If the first element of the count is equal to a user-specified value (traditionally 4), the count substate is reset to {0,0} and the base occupation substate is examined and potentially modified. If the base occupation substate is {True,True,True}, then the run component of the state is incremented; otherwise, the base occupation substate is rotated to the right and the first element replaced by True.
In Stage 2 of this examination, one examines the out component of the state. If it is equal to a user-specified value, one increments the inning, appends the current run state to the line score substate, resets the runs component to 0, and resets the out component to 0.
One continues this process until the inning component of the state is greater than a user-specified value.
This Demonstration outputs numerous statistics relating to the game created by this process. It outputs a "line score", a grid showing 11 elements of the simulated game, including the estimated "winning percentages" for each team, and an estimated game time. Exploring the controls shows that small changes in the percentage of strikes thrown or in the rules governing the progress of the game can have a dramatic effect on the outcome.