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 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>
-
FILE_SYSTEM - Gets data from files in the
./stats
directory. See thestats
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).
Available lineup generators:
- 1 - OrdinaryBatteryLineupGenerator
- Expects data formated like:
Bashful,4,0,0,0
- Which is interpreted as (name, hits... (homerun, out, out, out)
- Expects data formated like:
- 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)
- Expects data formated like:
- 3 - NoConsecutiveFemalesLineupGenerator
- Expects data formatted the same way as AlternatingBattingLineupGenerator except expect second value must be gender (A=male, B=female)
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
To add your own lineup generator:
- Implement BattingLienup and LineupGenerator.
- Register your new generator in the static map in the LineupType class.