diff options
| author | Lua Team <team@lua.org> | 1995-11-28 12:00:00 +0000 |
|---|---|---|
| committer | repogen <> | 1995-11-28 12:00:00 +0000 |
| commit | 71754d2f6423fb9b6e87658e58bafc5470d53f65 (patch) | |
| tree | c704e97b80e52a52d3152738941bb4c8ca676b97 /test/examples/complex/mandel.lua | |
| parent | a8b6ba0954edb9e0e669e1f451b9a8f145ce5166 (diff) | |
| download | lua-github-2.2.tar.gz | |
Lua 2.22.2
Diffstat (limited to 'test/examples/complex/mandel.lua')
| -rw-r--r-- | test/examples/complex/mandel.lua | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/test/examples/complex/mandel.lua b/test/examples/complex/mandel.lua new file mode 100644 index 00000000..5e3d3eb6 --- /dev/null +++ b/test/examples/complex/mandel.lua @@ -0,0 +1,25 @@ +dofile("complex.lua") + +xmin=-2 xmax=2 ymin=-2 ymax=2 +d=.125 + +function level(x,y) + local c=complex(x,y) + local l=0 + local z=c + repeat + z=z*z+c + l=l+1 + until abs(z)>2 or l>255 + return l-1 +end + +x=xmin +while x<xmax do + y=ymin + while y<ymax do + print(level(x,y)) + y=y+d + end + x=x+d +end |
