dart_dice_parser library
A Parser/evalutator for dice notation
Usage example:
int roll(String diceStr) {
var result = DiceParser().evaluate(diceStr);
if (result.isFailure) {
print("Failure:");
print('\t${expression}');
print('\t${' ' * (result.position - 1)}^-- ${result.message}');
return 1;
} else {
return result.value;
}
}
Classes
- DiceParser
- A Parser for dice notation
- DiceRoller
-
A dice roller for M dice of N sides (e.g.
2d6
). A roll returns a list of ints Also handles fudge die, and exploding die. - Statsimator
- uses Welford's algorithm to compute variance for stddev along with other stats