Working on this library as I need it for an app I'm creating and thought it would be useful to have separately. I'd like some feedback if anyone has any, and what people would also expect to see that isn't there already.
https://hex.pm/packages/diced
https://hexdocs.pm/diced/1.0.0-rc.1/diced.html
https://codeberg.org/sheetr/diced
#Diced - An algebraic dice notation parser in Gleam!
1 messages · Page 1 of 1 (latest)
what kinda feedback are you after
for this example, why is the amount of dice "2" instead of "5" (or 4)
echo diced.parse("5d20kh2kl2")
// Ok(diced.Basic(2, 20, [diced.KeepHighest(2), diced.KeepLowest(2)]))
If the API feels ergonomic (I think it does but I wrote it lmao) and if anyone feels like anything is missing. There two extra parts of the "spec" (there isn't an official one afaict) which haven't been implemented, but I do eventually want to do though - being Dice Pools ({1d20, 1d10}kh) and whatever the fuck you would call this: 1d20d20
I left the actual rolling/randomisation to the consumer of the library, but maybe I want a function similar to this fn roll(dice: Dice, random_fn: fn(Int, Int) -> Int)? I'm not sure and just left it out because of that
a Number is like the 4 in 1d6 + 4?
ah right I also don't have maths implemented, but yes it would be
outside of general feedback around me personally not knowing the notation i think you probably dont want DiceError to be opaque
ah oki doki
typo: width_modifier_value -> with_modifier_value