parse_dice_formula: Given a dice formula string, split it and return a dataframe...

View source: R/dice-formula.R

parse_dice_formulaR Documentation

Given a dice formula string, split it and return a dataframe with the list of functions.

Description

This is the main function to parse a string containing complex formula specifications for rolling dice.

Usage

parse_dice_formula(dice_formula)

Arguments

dice_formula

A string containing a dice formula, e.g. 1d6e2+1d4

Details

The input can be a string containing specifications for multiple dice, e.g.:

  • 1d6e6 -> roll 1 six-sided dice, explode on 6

  • 1d6e6+2d4-1d10 -> Roll 1 six-sided dice, explode on 6, plus two 4-sided dice, subract one 10-sided dice

This is inspired by Avrae's bot syntax for rolling dice. See https://github.com/avrae/d20


tidydice documentation built on Feb. 16, 2023, 7:50 p.m.