Master Knucklebones - the dice game from Cult of the Lamb. Train against AI opponents with 8 difficulty levels and win probability analysis.
Play at knuckletrainer.com
The game features a sophisticated multi-strategy AI system including:
- Neural Network: Policy-value network trained via self-play (PyTorch)
- Expectimax Search: Minimax with chance nodes for dice games
- Monte Carlo Tree Search (MCTS): For move evaluation and training
- Adaptive Learning: Master AI that learns opponent patterns
- Hybrid Neural MCTS: Combines neural network with MCTS search
For detailed documentation of all AI/ML strategies, see docs/AI_STRATEGIES.md.
This project is licensed under the MIT License. See LICENSE for details.
- Node.js 18+ and npm/yarn/pnpm/bun
- Rust and wasm-pack (for building the high-performance AI engine)
To install Rust and wasm-pack:
# Install Rust
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
# Install wasm-pack
curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | shFirst, build the WASM AI engine (one-time setup):
npm run build:wasmThen run the development server:
npm run dev
# or
yarn dev
# or
pnpm dev
# or
bun devOpen http://localhost:3000 with your browser to see the result.
The production build automatically includes the WASM module:
npm run buildFor optimized WASM builds:
npm run build:wasm:release
npm run buildThe AI engine uses Rust/WASM for maximum performance. The WASM module provides:
- 10-100x faster expectimax search compared to JavaScript
- Optimized transposition tables with efficient hashing
- Zero-copy data structures for minimal overhead
- Automatic fallback to JavaScript if WASM fails to load
The project is configured for automatic WASM builds in CI/CD:
- GitHub Actions: Automatically builds WASM on push/PR (see
.github/workflows/ci.yml) - Vercel: Automatically builds WASM during deployment (see
vercel.jsonandvercel-build.sh)
For detailed deployment instructions, see README-DEPLOYMENT.md.