ASCII Art: Mandelbrot Fractal

Mandelbrot Set ASCII
Click to zoom in

At the top of Ken Perlin’s homepage there is a strange C code:

main(k){float i,j,r,x,y=-16;while(puts(""),y++<15)for(x
=0;x++<84;putchar(" .:-;!/>)|&IH%*#"[k&15]))for(i=k=r=0;

I couldn't resist to test it. I just modified it a little bit to make it more readable:

int main(int argc, char** argv)
  int k = 2;
  float i,j,r,x,y=-16;
  while (puts(""), y++<15)
    for (x=0; x++<84; putchar(" .:-;!/>)|&IH%*#"[k&15]))
      for (i=k=r=0; 
  return 0;

The result of the execution of this code ? Simply the Mandrelbrot set in ASCII 😉


3 thoughts on “ASCII Art: Mandelbrot Fractal”

  1. Korvin77

    Thanks for posting. That’s why I love C… but we all understand that this is the dark side of the force 😀

  2. KevinRulz

    I love C too — better than fairy land c++

    i belong to and love the dark side 🙂

Comments are closed.