L-system: Difference between revisions

Content added Content deleted
m (→‎{{header|Raku}}: Add a Raku example)
(→‎{{header|Wren}}: Rabbit population example now uses new 'listSteps' method.)
Line 277: Line 277:
=={{header|Wren}}==
=={{header|Wren}}==
{{libheader|Wren-lsystem}}
{{libheader|Wren-lsystem}}
{{libheader|Wren-fmt}}
The source code for the Wren-lsystem module is available on this site by clicking the above link and then navigating to the Talk page.
The source code for the Wren-lsystem module is available on this site by clicking the above link and then navigating to the Talk page.


Line 287: Line 288:
[], // constants
[], // constants
"I", // axiom
"I", // axiom
[ // rules
[
Rule.new("I", "M"), // rules
Rule.new("I", "M"),
Rule.new("M", "MI")
Rule.new("M", "MI")
],
]
0 // angle (not needed here)
)
)


System.print("Step String")
System.print("Step String")
System.print("---- --------")
System.print("---- --------")
var steps = lsys.listSteps(5)
for (i in 0..5) Fmt.print("$-4d $8m", i, lsys.iterate(i))</syntaxhighlight>
for (i in 0..5) Fmt.print("$-4d $8m", i, steps[i])</syntaxhighlight>


{{out}}
{{out}}