Computer.L-SystemFractalGeneratorForJs1k History
Hide minor edits - Show changes to output
Changed line 3 from:
(:title L-System Fractal Generator for js1k:)
to:
(:title L-system Fractal Generator for js1k:)
Changed line 5 from:
For general information on Lindenmayer systems, see [[related Wikipedia article->http://en.wikipedia.org/wiki/L-system]].
to:
For general information on Lindenmayer systems, please see [[the related Wikipedia article->http://en.wikipedia.org/wiki/L-system]].
Added lines 1-53:
(:if userlang en:)
(:comment ----------------------------------------------------------------- :)
(:title L-System Fractal Generator for js1k:)
!!! Definition
For general information on Lindenmayer systems, see [[related Wikipedia article->http://en.wikipedia.org/wiki/L-system]].
The script that I wrote for [[js1k contest->http://js1k.com/2012-love/]] generates given L-system code on the screen. It supports turning (@@+@@ and @@−@@), drawing (@@F@@ and @@G@@) and push/pop (@@[=[=]@@ and @@[=]=]@@) operators.
An L-system code consists of the following lines.
:@@iters[=:=]@@ ''n'': The number of iterations. The more iterations performed, the more detail is achieved and the more time is spent.
:@@angle[=:=]@@ ''Θ'': The turning angle in degrees. For example, 60 or 90.
:@@start[=:=]@@ @@"@@''S''@@"@@: The initial axiom. The computation starts with string ''S''.
:''X''@@[=:=]@@ @@"@@''Y''@@"@@: A rewriting rule. In each iteration all ''X''s in the current string is substituted with ''Y''s.
!!! Examples
!!!! Right-angled Koch Curve from Wikipedia
[@
iters: 4
angle: 90
start: "F"
F: "F+F−F−F+F"
@]
!!!! Right-angled Koch curve from Wikipedia
[@
iters: 4
angle: 90
start: "F"
F: "F+F−F−F+F"
@]
!!!! Sierpinski triangle from Wikipedia
[@
iters: 8
angle: 60
start: "F"
F: "G-F-G"
G: "F+G+F"
@]
(:comment ----------------------------------------------------------------- :)
(:if userlang tr:)
(:comment ----------------------------------------------------------------- :)
(:title js1k için L-system Fraktal Üreteci:)
Bu sayfanın Türkçesi hazır değil.
(:comment ----------------------------------------------------------------- :)
(:if:)