/** This is a very simple demonstration program that shows the basics of
calculating the Mandelbrot set and displaying it as text. */
chars = [".", ",", "\"", "-", ":", "/", "(", "*", "|", "$", "#", "@", "%", "~"]
for im = -1.2 to 1.2 step .05
{
imag = i * im
for real = -2 to 1 step .04
{
C = real + imag
z = 0
count = -1
do
{
z = z^2 + C
count=count+1;
} while abs[z] < 4 and count < 14
print[chars@(count-1)]
}
println[]
}