Packages

Simple algebraic dice notation parser for Gleam

Current section

Files

Jump to
diced README.md
Raw

README.md

# Diced
Simple algebraic dice notation parser for Gleam
[![Package Version](https://img.shields.io/hexpm/v/diced)](https://hex.pm/packages/diced)
[![Hex Docs](https://img.shields.io/badge/hex-docs-ffaff3)](https://hexdocs.pm/diced/)
```sh
gleam add diced
```
```gleam
import diced
pub fn main() {
echo diced.parse("1d6")
// Ok(diced.Basic(1, 6, []))
echo diced.parse("5d20kh2kl2")
// Ok(diced.Basic(5, 20, [diced.KeepHighest(2), diced.KeepLowest(2)]))
echo diced.parse("1")
// Ok(diced.Number(1, []))
echo diced.parse("4dF")
// Ok(diced.Fate(4, []))
}
```
Further documentation can be found at <https://hexdocs.pm/diced>.
## Development
```sh
gleam run # Run the project
gleam test # Run the tests
```