Difference between revisions of "Dice/RollerConfig/MaxRecursionDepth"

From DiceRoller Documentation
(add graph)
Line 17: Line 17:
 
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 {{c|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.
 
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 {{c|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">
+
<graphviz format="svg" caption="AST for above expression" desc="none">
 
digraph AST {
 
digraph AST {
 
mult[label="*"]
 
mult[label="*"]

Revision as of 18:50, 10 April 2017

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

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

Syntax

public ushort MaxRecursionDepth { get; set; }

Property Value

Type: System.UInt16

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>