This is an implementation of the AnyDice DSL, which was created by Jasper Flick. This project is not affiliated with AnyDice or Jasper Flick.
It can run as a command-line utility, or as a web-based tool, with evaluation occurring in real time in the browser.
Eurydice should be somewhat faster than AnyDice, but unlike AnyDice, it runs client side, so performance may vary depending on your computer's performance. Eurydice implements the Icepool algorithm developed by Albert Liu.1 The Eurydice web UI also supports syntax highlighting and inline errors.
See the web UI at https://eurydice.pages.dev.
eurydice-demo.mp4
You can also run a simple CLI locally. Install cargo if necessary, then:
git clone https://github.com/MattX/eurydice.git
cd eurydice/eurydice_cli
cargo run --releaseTry:
> output 2d3 + d4
output 1:
3 2.778% |━━━━━━━━
4 8.333% |━━━━━━━━━━━━━━━━━━━━━━━━
5 16.667% |━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
6 22.222% |━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
7 22.222% |━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
8 16.667% |━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
9 8.333% |━━━━━━━━━━━━━━━━━━━━━━━━
10 2.778% |━━━━━━━━
See the language specification, or the AnyDice docs.
Contributions are more than welcome! Either in the UI or the core language. Some ideas:
- New output options
- Many performance optimizations could be made
- More test coverage is always welcome
The packages in this directory are:
eurydice_engine: Contains a parser and evaluator for AnyDice programs (Rust).eurydice_cli: Contains a CLI frontend for Eurydice. Most serious tests are in this package so we can display results in a pretty way without bundling terminal dependencies ineurydice_engine.eurydice_wasm: WASM wrapper foreurydice_engineeurydice_www: A Vite + React + TS app to serve as a frontend.
Build the wasm (from this directory) with wasm-pack build ./eurydice_wasm. Then cd to eurydice_www, run npm i and npm run dev.
See also notes in https://rustwasm.github.io/wasm-bindgen/examples/wasm-in-web-worker.html.
Footnotes
-
Liu, A. J. (2022). Icepool: Efficient Computation of Dice Pool Probabilities. Proceedings of the AAAI Conference on Artificial Intelligence and Interactive Digital Entertainment, 18(1), 258-265. https://doi.org/10.1609/aiide.v18i1.21971 ↩