Class DiceExpression
The default class for representing a parsed dice expression.
Inheritance
Implements
Inherited Members
Namespace: GoRogue.DiceNotation
Assembly: GoRogue.dll
Syntax
public class DiceExpression : IDiceExpression
Constructors
| Improve this Doc View SourceDiceExpression(ITerm)
Constructor. Takes the last term in the dice expression (the root of the expression tree).
Declaration
public DiceExpression(ITerm termToEvaluate)
Parameters
Type | Name | Description |
---|---|---|
ITerm | termToEvaluate | The root of the expression tree -- by evaluating this term, all others will be evaluated recursively. |
Methods
| Improve this Doc View SourceMaxRoll()
Returns the maximum possible result of the dice expression.
Declaration
public int MaxRoll()
Returns
Type | Description |
---|---|
System.Int32 | The maximum possible result of the dice expression. |
MinRoll()
Returns the minimum possible result of the dice expression.
Declaration
public int MinRoll()
Returns
Type | Description |
---|---|
System.Int32 | The minimum possible result of the dice expression. |
Roll(IGenerator)
Rolls the expression using the RNG given, returning the result.
Declaration
public int Roll(IGenerator rng = null)
Parameters
Type | Name | Description |
---|---|---|
Troschuetz.Random.IGenerator | rng | The RNG to use. If null is specified, the default RNG is used. |
Returns
Type | Description |
---|---|
System.Int32 | The result obtained by rolling the dice expression. |
ToString()
Returns a parenthesized string representing the dice expression in dice notation
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
System.String | A paranethesized string representing the expression. |