Baseball Fun is an open-source baseball simulator.
🚧 This simulator is under active development 🚧
- Simulate a simplistic baseball game (
packages/utils/src/entities/game-sim/GameSim.ts
is where this lives) - Save the simulated game results
- Build a view to show the statistics/logs of a game
- Train data from the 2011 MLB season to build models for simulation (2011, because Cardinals!)
- Website to simulate 2011 MLB season and display league leaders, standings, etc.
- Install packages with
bun install
at the root folder - In VSCode, run tasks by pressing
Ctrl+Shift+P
and typingTasks: Run Task
- Run task
dev-server
to start the dev server
- Use the Bun runtime because it's awesome.
- Use Typescript/Javascript as much as possible
- Use R language for any data science/analysis not possible in the Javascript ecosystem
- Use a Bun workspace
- Learn machine learning to build models for simulation
- Make fully typed (no Typescript
any
!)
- biomejs for linting and formatting code
- Bun runtime to run Typescript code
- csv-string to parse CSV files
- dayjs to parse CSV files
- faker to generate fake data
- MessagePack to serialize data
- lodash for utility functions
- TensorFlowJS for machine learning
- zod for validating data
- baseballr for historical ID player mappings
- Out of the Park Baseball for player ratings
- PitchFx for pitch data
-
Camel case everything
-
The utils package hosts the constants, entities, functions, and types that are shared across the project.
The file names are prefixed with an abbreviation of the type of file for easier searchability within VSCode.
cFILENAME = constants
eFILENAME = entities
fFILENAME = functions
tFILENAME = types
Haven't been able to find a Node.js machine learning library that works in Bun. I'm currently using TensorFlowJS, but it's not ideal. Training is slow and need to save/access the models via upload and download the models to/from the server. TensorFlowJS Node is working in Bun!
The main reason I'm creating this simulator is to learn. If you have any feedback, comments, or questions please reach out. I'm open to any suggestions and ideas.
Click the Discussions
at the top of this repo to reach out.