Mandelbrot set: Difference between revisions
Content added Content deleted
m (→{{header|Raku}}: use "raku" for syntax highlight) |
|||
Line 5,228: | Line 5,228: | ||
<syntaxhighlight lang="easylang"> |
<syntaxhighlight lang="easylang"> |
||
# Mandelbrot |
|||
# |
|||
res = 4 |
res = 4 |
||
maxiter = 200 |
maxiter = 200 |
||
Line 5,244: | Line 5,246: | ||
textsize 2 |
textsize 2 |
||
# |
# |
||
fastfunc iter cx cy maxiter . |
|||
while xx + yy < 4 and it |
while xx + yy < 4 and it < maxiter |
||
y = 2 * x * y + cy |
y = 2 * x * y + cy |
||
x = xx - yy + cx |
x = xx - yy + cx |
||
xx = x * x |
xx = x * x |
||
yy = y * y |
yy = y * y |
||
it |
it += 1 |
||
. |
. |
||
return it |
|||
. |
. |
||
proc draw . . |
proc draw . . |
||
Line 5,259: | Line 5,262: | ||
for scr_x = 0 to 2 * mid - 1 |
for scr_x = 0 to 2 * mid - 1 |
||
cx = (scr_x - center_x) / scale |
cx = (scr_x - center_x) / scale |
||
it = maxiter |
it = iter cx cy maxiter |
||
if it < maxiter |
|||
if it > 0 |
|||
it = maxiter - it |
|||
color3 it / 20 it / 100 it / 150 |
color3 it / 20 it / 100 it / 150 |
||
move scr_x / res scr_y / res |
move scr_x / res scr_y / res |
||
Line 5,288: | Line 5,289: | ||
scale /= 4 |
scale /= 4 |
||
. |
. |
||
draw |
|||
. |
. |
||
draw |
|||
</syntaxhighlight> |
</syntaxhighlight> |
||