A dice roller accepting dice notation written in Rust. A spiritual successor to froll.
d8
, 2d12
.d4 + 2d6
.d100 - 15
.d12 * 2
.d100 / 15
. (Note that fractional values are rounded to the nearest integer.)(d100 + d12) / 15
.1d4 + 2d6 * 3d2 / 4d8 + (2d6 + 3d8) - 16 * (1 / 1d4)
.Static functions
roll(input: &str)
-> Returns a DiceRolls
object.
Struct DiceRolls
| Fields | Type | Description |
|-----------------|-----------------|---------------------------------------------------------------------------------------------------------------------------------------------|
| rolls
| Vec<DiceRoll>
| Vector of DiceRoll
. |
| formula
| Vec<String>
| Vector of String
s that contains the parsed formula written in postfix (RPN). |
| rolls_formula
| Vec<String>
| Vector of String
s that contains the parsed formula written in postfix (RPN) with the original dice notation instead of the rolled result. |
| Methods | Return Type | Description |
|--------------------------------------------|-------------|-----------------------------------------------------------------------------------------------------------------------|
| get_result(&self)
| i32
| Returns the solved result of the formula. |
| get_sum_of_rolls(&self)
| i32
| Returns a simple sum of the rolls. |
| get_rolls_string(&self)
| String
| Returns a formatted String
showing the dice and the rolled results. |
| get_formula_string_as_rpn(&self)
| String
| Returns a postfix formatted String
showing the formula. |
| get_formula_string_as_infix(&self)
| String
| Returns an infix formatted String
showing the formula. |
| get_rolls_formula_string_as_rpn(&self)
| String
| Returns a postfix formatted String
showing the formula withthe original dice notation instead of the rolled result. |
| get_rolls_formula_string_as_infix(&self)
| String
| Returns a infix formatted String
showing the formula withthe original dice notation instead of the rolled result. |
Struct DiceRoll
| Fields | Type | Description |
|-----------------|---------|---------------------------------------|
| sides
| i32
| Number of sides the rolled dice had |
| result
| i32
| Result of the roll |
rfyl is Public Domain software available under the Creative Commons 0. See LICENSE and COPYING for more information.