At Bat Algorithm - mrketchup/playball GitHub Wiki
This is a brainstorm of the algorithm for an at bat. It is not necessarily the algorithm used in the program.
League Average
* Batter's Factor
* Pitcher's Factor (if applicable)
* Defense Factor (if applicable)
* pitch count effect
* L v R platoon effect
* park effect
* home/away effect
* league difficulty effect
* base/out situation effect
* day vs night effect
* weather effect
if intentional walk situation AND manager elects for intentional walk
issue intentional walk
else
if manager determines sac attempt
attempt sacrifice
determine outcome of sacrifice
else
determine bunt attempt rate
if a bunt
determine outcome when bunting
else
determine non-bunt outcome
if out turns into error
runner is safe
else if double play situation
determine double play success rate