mirror of
https://github.com/zdharma-continuum/zinit-configs.git
synced 2025-01-31 04:08:16 +01:00
17 lines
456 B
Bash
17 lines
456 B
Bash
# DESC: Draws mandelbrot fractal
|
|
|
|
integer lines columns colour i=0
|
|
float a b p q pnew delta1 delta2
|
|
((columns=COLUMNS-1, lines=LINES-1, colour=0))
|
|
for ((b=-1.5; b<=1.5; b+=3.0/lines)) do
|
|
for ((a=-2.0; a<=1; a+=3.0/columns)) do
|
|
for ((p=0.0, q=0.0, i=0; p*p+q*q < 4 && i < 32; i++)) do
|
|
((pnew=p*p-q*q+a, q=2*p*q+b, p=pnew))
|
|
done
|
|
((colour=(i/4)%8))
|
|
echo -n "\\e[4${colour}m "
|
|
done
|
|
echo
|
|
done
|
|
|
|
# vim:ft=zsh:et
|