Difference between revisions of "Dice/RollerConfig/MaxRecursionDepth"

From DiceRoller Documentation
 
Line 6: Line 6:
 
== Syntax ==
 
== Syntax ==
 
<syntaxhighlight lang="C#">
 
<syntaxhighlight lang="C#">
public ushort MaxRecursionDepth { get; set; }
+
public short MaxRecursionDepth { get; set; }
 
</syntaxhighlight>
 
</syntaxhighlight>
  
 
=== Property Value ===
 
=== Property Value ===
Type: System.UInt16
+
Type: System.Int16
  
 
The maximum amount of nesting that can happen in dice expressions. Exceeding this limit will result in a [[Dice/DiceException|DiceException]] being thrown with DiceErrorCode.RecursionDepthExceeded.
 
The maximum amount of nesting that can happen in dice expressions. Exceeding this limit will result in a [[Dice/DiceException|DiceException]] being thrown with DiceErrorCode.RecursionDepthExceeded.

Latest revision as of 18:57, 13 April 2017

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>