< Dice‎ | RollerConfig
Revision as of 18:57, 13 April 2017 by Skizzerz (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

RollerConfig.MaxRecursionDepth Property

From DiceRoller Documentation

Gets or sets how deeply nested a dice expression can get.

  • Namespace: Dice
  • Assembly: DiceRoller (in DiceRoller.dll)

Syntax

public short MaxRecursionDepth { get; set; }

Property Value

Type: System.Int16

The maximum amount of nesting that can happen in dice expressions. Exceeding this limit will result in a DiceException being thrown with DiceErrorCode.RecursionDepthExceeded.

Remarks

The default value for MaxRecursionDepth is 20. It is recommended to not set this too high, but it should be high enough to handle complex rolls. For example, the dice expression floor((1d20rr<5dl1 + 2) * 1.5) has a depth of 5 (see below for a representation of the abstract syntax tree). The topmost operation counts as depth 0 rather than depth 1 for the purposes of MaxRecusionDepth.

<graphviz format="svg" caption="AST for above expression" desc="none"> digraph AST { mult[label="*"] add[label="+"] reroll[label="rr<5"] drop[label="dl1"] roll[label="1d20"] floor -> mult -> add -> drop -> reroll -> roll mult -> 1.5 add -> 2 } </graphviz>