Skip to main content

expand

Function expand 

Source
pub fn expand(axiom: &str, rules: &[(char, String)], depth: u32) -> String
Expand description

Expand axiom by applying rules depth times. Each rule is (predecessor, successor); a character with no matching rule maps to itself (the standard context-free L-system semantics). Pure and deterministic.

Runs only at preset load. Growth is bounded by the caller clamping depth (see MAX_LSYSTEM_DEPTH); the turtle then caps the segment count.