Show / Hide Table of Contents

Class DiceExpression

The default class for representing a parsed dice expression.

Inheritance
System.Object
DiceExpression
Implements
IDiceExpression
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
Namespace: GoRogue.DiceNotation
Assembly: GoRogue.dll
Syntax
public class DiceExpression : IDiceExpression

Constructors

| Improve this Doc View Source

DiceExpression(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 Source

MaxRoll()

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.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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.

Overrides
System.Object.ToString()

Implements

IDiceExpression

Extension Methods

Utility.Yield<T>(T)
  • Improve this Doc
  • View Source
Back to top Generated by DocFX