Mandelbrot set: Difference between revisions
Content deleted Content added
m →{{header|Wren}}: Changed to Wren S/H |
|||
(14 intermediate revisions by 4 users not shown) | |||
Line 1,915:
==={{header|AmigaBASIC}}===
{{trans|QBasic}}
[[File:Amigabasic mandelbrot.png|thumb|Output]]
<syntaxhighlight lang="
WINDOW 2,"Mandelbrot",,0,1
Line 1,964:
WHILE (1)
WEND</syntaxhighlight>
==={{header|Applesoft BASIC}}===
Line 2,466 ⟶ 2,467:
==={{header|Locomotive Basic}}===
{{trans|QBasic}}
[[File:Cpcbasic mandelbrot.png|thumb|CPCBasic output]]
This program is meant for use in [https://benchmarko.github.io/CPCBasic/cpcbasic.html CPCBasic] specifically, where it draws a 16-color 640x400 image in less than a minute. (Real CPC hardware would take far longer than that and has lower resolution.)
<syntaxhighlight lang="
2 FOR xp = 0 TO 639
3 FOR yp = 0 TO 399
Line 5,016 ⟶ 5,018:
=={{header|Dart}}==
Implementation in
The implementation uses
<syntaxhighlight lang="dart">
class Complex {
double _r, _i;
Complex(this._r, this._i);
}
void main() {
for (int y = 0; y < 20; y++) {
String line = "";
for (int x = 0; x < 70; x++) {
for (int i = 0; i < 100; i++) {
z = z *
if (z.abs() > 2) {
break;
}
}
line += z.abs() > 2 ? " " : "*";
}
print(line);
}
}
}</syntaxhighlight>▼
=={{header|Dc}}==
Line 5,225 ⟶ 5,230:
=={{header|EasyLang}}==
[https://easylang.
<syntaxhighlight
res = 4
maxiter = 200
Line 5,641 ⟶ 5,644:
===Graphical version===
[[File:Mandelbrot emacs lisp.png|thumb|Output]]
With a few modifications (mandel-size, mandel-iter, string-to-image, mandel-pic), the code above can also render the Mandelbrot fractal to an XPM image and display it directly in the buffer. (You might have to scroll up in Emacs after the function has run to see its output.)
<syntaxhighlight lang="lisp">; === Graphical Mandelbrot ============================================
Line 12,454 ⟶ 12,458:
# for which the sequence z[n+1] := z[n] ** 2 + z[0] (n >= 0) is bounded.
# Since this program is computing intensive it should be compiled with
#
const integer: pix is 200;
Line 12,486 ⟶ 12,490:
z0 := center + complex(flt(x) * zoom, flt(y) * zoom);
point(x + pix, y + pix, colorTable[iterate(z0)]);
end for;
end for;
end func;
Line 12,504 ⟶ 12,508:
end for;
displayMandelbrotSet(complex(-0.75, 0.0), 1.3 / flt(pix));
readln(KEYBOARD);
end func;
Line 13,564 ⟶ 13,568:
0 OK, 0:1726 </pre>
=={{header|Uiua}}==
<syntaxhighlight lang="uiua">
Size ← 800
Cs ← ÷ 5[5_5_5 4_5_5 4_5_5 3_5_5 5_3_5 3_3_5 2_5_0 5_2_2 2_2_5 0_0_0]
# Initialise complex co-ordinates.
×2.5 ⊞ℂ:-1/4. ÷:-÷2,⇡.⟜(↯:0⊟.)Size
# Iterate 50 times (a, b, got_there) -> (a*a+b, b, got_there)
# got_there counts when corresponding value in b hits 2.
⍥⊃(+×.|⋅∘|+<2⌵⊙◌)50 0
# Scale the results down and display
⊏:Cs⌈×9÷:⟜(/↥/↥)ₙ2◌◌
</syntaxhighlight>
{{out}}
[[File:Uiua Mandelbrot Set.png|thumb|center]]
=={{header|UNIX Shell}}==
Line 14,332 ⟶ 14,353:
var Game = MandelbrotSet.new(800, 600)</syntaxhighlight>
{{out}}
[[File:Wren-Mandelbrot_set.png|400px]]
=={{header|XPL0}}==
|