Skip to content

Monte Carlo simulation tool for making sure you choose the best lineup for your softball or baseball team.

License

Notifications You must be signed in to change notification settings

JeffFaer/softball-sim

 
 

Repository files navigation

SoftballSim

Monte Carlo simulation tool for making sure you choose the best lineup for your softball, baseball, or kickball team. Used by softball.app for lineup optimizations but can also be run from the command line on file system data.

Build and Run (requires java, replace ./gradlew with ./gradlew.bat for windows machines):

./gradlew build -x test
./gradlew jar
java -jar ./build/libs/softball-sim.jar FILE_SYSTEM 0

To run tests:

./gradlew clean test --info

Arguments

Arguments to be supplied to the jar take the form:

java -jar ~/build/lib softball-sim.jar <dataSource(string)> <lineupType(string) OR lineupType ordinal(int)> <iterations(int) optional> <threadsToUse(int) optional>

dataSource options

  • FILE_SYSTEM - Gets data from files in the ./stats directory. See the stats directory in this repository for example files. Application will attempt to read data of all files in the ./stats directory.

  • NETWORK - Gets data from a network connection. This option is intended to be used mostly by softball-scorer app (https://github.com/thbrown/softball-scorer).

lineupType options

Available lineup generators:

  • 1 - OrdinaryBatteryLineupGenerator
    • Expects data formated like: Bashful,4,0,0,0
    • Which is interpreted as (name, hits... (homerun, out, out, out)
  • 2 - AlternatingBattingLineupGenerator
    • Expects data formated like: Hermione Granger,B,1,0,2,1
    • Which is interpreted as (name, group [e.g. A=male, B=female], hits... (single, out, double, single)
  • 3 - NoConsecutiveFemalesLineupGenerator
    • Expects data formatted the same way as AlternatingBattingLineupGenerator except expect second value must be gender (A=male, B=female)

Notes

Hit data is an integer 0-4 (inclusive) that represents the number of bases the player reached in each of their at bats. Explicitly:

  • 0 => out/error/fielder's choice
  • 1 => single/walk
  • 2 => double
  • 3 => triple
  • 4 => homerun

Extending the simulation

To add your own lineup generator:

  1. Implement BattingLienup and LineupGenerator.
  2. Register your new generator in the static map in the LineupType class.

About

Monte Carlo simulation tool for making sure you choose the best lineup for your softball or baseball team.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Java 99.5%
  • Other 0.5%