Eser Aygün

Home Page

Computer

Music

Photos

eseraygun.com

E-mail Address

login

14.02.2012 · Print · History · Edit

L-system Fractal Generator for js1k

Computer.LsystemFractalGeneratorForJS1K History

Hide minor edits - Show changes to output

14.02.2012 by 212.101.96.3 -
Changed lines 7-8 from:
The script that I wrote for [[js1k contest->http://js1k.com/2012-love/]] executes given L-system code and generates fractals on the screen. It supports turning (@@+@@ and @@−@@), drawing (lowercase letters) and push/pop (@@[=[=]@@ and @@[=]=]@@) operators.
to:
[[The script->http://js1k.com/2012-love/demo/1066]] that I wrote for [[js1k contest->http://js1k.com/2012-love/]] executes given L-system code and generates fractals on the screen. It supports turning (@@+@@ and @@−@@), drawing (lowercase letters) and push/pop (@@[=[=]@@ and @@[=]=]@@) operators.
Added lines 99-109:

!!! User's Discoveries

!!!! Swiss Cross by [[Forrest Oliphant->http://forresto.com/]]
[@
iters: 6
angle: 90
start: "x-ff-x"
x: "xf+fx-ff-xf+fx"
@]
09.02.2012 by 85.97.244.82 -
Changed lines 23-27 from:
iters:5
angle:45
start:"X"
X:"+ff++f++f--f++f++ff"
f:"fff[-ffX][+fX]"
to:
iters: 5
angle: 45
start: "X"
X: "+ff++f++f--f++f++ff"
f: "fff[-ffX][+fX]"
09.02.2012 by 85.97.244.82 -
Added lines 20-28:

!!!! Fractal of Love by me
[@
iters:5
angle:45
start:"X"
X:"+ff++f++f--f++f++ff"
f:"fff[-ffX][+fX]"
@]
09.02.2012 by 85.97.244.82 -
Changed line 17 from:
:''X''@@[=:=]@@ @@"@@''Y''@@"@@: A rewriting rule. In each iteration all ''X''s in the current string are substituted with ''Y''s.
to:
:''X''@@[=:=]@@ @@"@@''Y''@@"@@: A rewrite rule. In each iteration all ''X''s in the current string are substituted with ''Y''s.
09.02.2012 by 85.97.244.82 -
Changed line 7 from:
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 (lowercase letters) and push/pop (@@[=[=]@@ and @@[=]=]@@) operators.
to:
The script that I wrote for [[js1k contest->http://js1k.com/2012-love/]] executes given L-system code and generates fractals on the screen. It supports turning (@@+@@ and @@−@@), drawing (lowercase letters) and push/pop (@@[=[=]@@ and @@[=]=]@@) operators.
09.02.2012 by 85.97.244.82 -
Changed line 13 from:
:@@angle[=:=]@@ ''Θ'': The turning angle in degrees. For example, 60 or 90.
to:
:@@angle[=:=]@@ ''Θ'': The turning angle in degrees.
09.02.2012 by 85.97.244.82 -
Changed lines 17-18 from:
:''X''@@[=:=]@@ @@"@@''Y''@@"@@: A rewriting rule. In each iteration all ''X''s in the current string is substituted with ''Y''s.
to:
:''X''@@[=:=]@@ @@"@@''Y''@@"@@: A rewriting rule. In each iteration all ''X''s in the current string are substituted with ''Y''s.
Changed line 21 from:
!!!! Koch curve
to:
!!!! [[Koch snowflake->http://en.wikipedia.org/wiki/Koch_curve]]
Changed line 23 from:
iters: 6
to:
iters: 5
Changed line 25 from:
start: "f"
to:
start: "f--f--f"
Changed line 29 from:
!!!! Sierpinski triangle from Wikipedia
to:
!!!! [[Dragon curve->http://en.wikipedia.org/wiki/Dragon_curve]]
Changed lines 31-35 from:
iters: 8
angle: 60
start: "f"
f: "g-f-g"
g: "f+g+f"
to:
iters: 12
angle: 90
start: "fX"
X: "X+Yf+"
Y: "-fX-Y"
Changed line 38 from:
!!!! Fractal plant from Wikipedia
to:
!!!! [[Gosper curve->http://en.wikipedia.org/wiki/Gosper_curve]]
Changed lines 40-44 from:
iters: 6
angle: 25
start: "+++X"
X: "f+[[X]-X]-f[-fX]+X"
f: "ff"
to:
iters: 5
angle: 60
start: "Xf"
X: "X+Yf++Yf-fX--fXfX-Yf+"
Y: "-fX+YfYf++Yf+fX--fX-Y"
Changed line 47 from:
!!!! Fractal plant by [[Adrian Mariano->http://www.nahee.com/spanky/www/fractint/lsys/plants.html]]
to:
!!!! [[Moore curve->http://en.wikipedia.org/wiki/Moore_curve]]
Added lines 49-57:
iters: 7
angle: 90
start: "L"
L: "-Rf+LfL+fR-"
R: "+Lf−RfR−fL+"
@]

!!!! [[Sierpinski triangle->http://en.wikipedia.org/wiki/Sierpinski_triangle]]
[@
Changed lines 59-62 from:
angle: 18
start: "+++++X"
X: "f[+X]f[-X]+X"
f: "ff"
to:
angle: 60
start: "f"
f: "g-f-g"
g: "f+g+f"
Changed line 65 from:
!!!! Another fractal plant by Adrian Mariano
to:
!!!! Fractal plant from [[Wikipedia->http://en.wikipedia.org/wiki/L-system#Example_8:_Fractal_plant]]
Changed lines 67-70 from:
iters: 4
angle: 22.5
start: "++++F"
F: "FF-[-F+F+F]+[+F-F-F]"
to:
iters: 6
angle: 25
start: "+++X"
X: "f+[[X]-X]-f[-fX]+X"
f: "ff
"
Changed line 74 from:
!!!! Spacefilling tile
to:
!!!! Fractal plant by [[Adrian Mariano->http://www.nahee.com/spanky/www/fractint/lsys/plants.html]]
Changed lines 76-84 from:
iters: 7
angle: 36
start: "Q"
P: "--FR++++FS--FU"
Q: "FT++FR----FS++"
R: "++FP----FQ++FT"
S:
"FU--FP++++FQ--"
T:
"+FU--FP+"
U:
"-FQ++FT-"
to:
iters: 8
angle: 18
start: "+++++X"
X: "f[+X]f[-X]+X"
f: "ff"
@]

!!!!
Another fractal plant by Adrian Mariano
[@
iters: 4
angle: 22.5
start:
"++++f"
f: "ff-[-f+f+f]+[+f-f-f]
"
09.02.2012 by 85.97.244.82 -
Changed lines 7-8 from:
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.
to:
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 (lowercase letters) and push/pop (@@[=[=]@@ and @@[=]=]@@) operators.
Changed line 21 from:
!!!! Right-angled Koch Curve from Wikipedia
to:
!!!! Koch curve
Changed lines 23-26 from:
iters: 4
angle: 90
start: "F"
F: "F+F−F−F+F"
to:
iters: 6
angle: 60
start: "f"
f: "f+f--f+f"
Changed lines 33-35 from:
start: "F"
F: "G-F-G"
G: "F+G+F"
to:
start: "f"
f: "g-f-g"
g: "f+g+f"
Changed lines 43-44 from:
X: "F+[[X]-X]-F[-FX]+X"
F: "FF"
to:
X: "f+[[X]-X]-f[-fX]+X"
f: "ff"
Changed line 47 from:
!!!! Fractal plant by [[Adrian Mariano->http://www.nahee.com/spanky/www/fractint/lsys/]]
to:
!!!! Fractal plant by [[Adrian Mariano->http://www.nahee.com/spanky/www/fractint/lsys/plants.html]]
Changed lines 52-53 from:
X: "F[+X]F[-X]+X"
F: "FF"
to:
X: "f[+X]f[-X]+X"
f: "ff"
Added lines 62-74:
@]

!!!! Spacefilling tile
[@
iters: 7
angle: 36
start: "Q"
P: "--FR++++FS--FU"
Q: "FT++FR----FS++"
R: "++FP----FQ++FT"
S: "FU--FP++++FQ--"
T: "+FU--FP+"
U: "-FQ++FT-"
09.02.2012 by 85.97.244.82 -
Added lines 45-61:
@]

!!!! Fractal plant by [[Adrian Mariano->http://www.nahee.com/spanky/www/fractint/lsys/]]
[@
iters: 8
angle: 18
start: "+++++X"
X: "F[+X]F[-X]+X"
F: "FF"
@]

!!!! Another fractal plant by Adrian Mariano
[@
iters: 4
angle: 22.5
start: "++++F"
F: "FF-[-F+F+F]+[+F-F-F]"
09.02.2012 by 85.97.244.82 -
Changed line 29 from:
!!!! Right-angled Koch curve from Wikipedia
to:
!!!! Sierpinski triangle from Wikipedia
Changed lines 31-32 from:
iters: 4
angle: 90
to:
iters: 8
angle: 60
Changed lines 34-35 from:
F: "F+F−F−F+F"
to:
F: "G-F-G"
G: "F
+G+F"
Changed line 38 from:
!!!! Sierpinski triangle from Wikipedia
to:
!!!! Fractal plant from Wikipedia
Changed lines 40-44 from:
iters: 8
angle: 60
start: "F"
F: "G-F-G"
G: "
F+G+F"
to:
iters: 6
angle: 25
start: "+++X"
X: "F+[[X]-X]-F[-FX]+X"
F: "FF"
09.02.2012 by 85.97.244.82 -
Added lines 1-52:
(:if userlang en:)
(:comment ----------------------------------------------------------------- :)
(:title L-system Fractal Generator for js1k:)

For general information on Lindenmayer systems, please see [[the 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:)