Tiny Dice Rolling POC
Can be used in 3 different ways:
- Visit the website: https://olian04.github.io/dice-roller/
- Install it as a node js library
- Install it as a shell command
npm i @olian/dice-roller
const rollDice = require('@olian/dice-roller');
const input = '2d4 + 2 + d6';
console.log(input);
const result = rollDice(input);
console.log(result.values.join(' + '), '=', result.sum);
$ sudo npm i -g @olian/dice-roller
$ roll 2d4 + 2 + d6
2d4 + 2 + d6
3 + 4 + 2 + 2 = 11
Input string can be any combination of dice including static rolls.
Ex:
- 2d6
- 3d4 + 3
- 2d10 + 4d9 + 2
- d20
- d20 d20 d20
- d3 2d5 d10 + 6