Javascript Mandelbrot plotter - part 2

I've made a few tweaks to my javascript mandelbrot drawing code, so there's a new version uploaded here. You can now select three different colours and a palette will be interpolated made up from in-between colours.

So, here's an example that I came up with using the new version:

There's a couple more simple options in this version, like a choice of fractal sizes and a reset button. It would be handy to have an 'undo' option for those times when you've made a slip of the mouse...

So, don't be surprised if there are more changes to come.

Raspberry Pi low-res fractal in C

Of course, it wouldn't be me unless I tried drawing a mandelbrot on the Raspberry Pi. Here is the traditional ASCII character version, but with some low-res colours.

Raspberry Pi Mandelbrot in C

I have to admit that the colour idea was inspired by somebody called Paulo Lellis, who had read some of my previous posts and adapted my code to include colour codes. It was very kind of Paulo to show me what he had done. I've simply tweaked it some more.

Anyway, if you'd like to try it, here is the source code:

#include <stdio.h>

/*
   Compile like this:
   gcc mandel.c

   Then run the code, like this
   /.a.out
*/

main()
{
   float b,e,r,n,d;
   int h;
	
   for(e=1.1; e>-1.2; e-=.1)
   {
      for(b=-2; b<1; b+=.04)
      {
         // see: http://en.wikipedia.org/wiki/ANSI_escape_code#graphics
         printf("\033[1;4%dm%c\033[0m",(h%8),32);
				
         n=0;
         h=127;
         for(r=0; r*r+n*n<4 && --h>32; d=r)
         {
            r = r*r-n*n+b;
            n = 2*d*n+e;
         }
      }
      printf("\r\n");
   }
}

Well, I had to try the C compiler on the Raspberry Pi at some point.

Fractals on the real thing

My RT-11 boot disk with DECUS C worked a treat on the real machine.  It took 16 seconds for it to draw the mandelbrot set in ASCII art on the actual uPDP-11/53.  Here is a picture of the real thing in action:

ASCII fractal on a real PDP-11

I would say that's a result.  My next project is to use memory-mapped I/O in C to communicate over the second serial line.  This may allow me to hook the PDP to my serial-to-wifi board.

PDP-11 Fractals in ASCII Art

Now that I have a C compiler for the PDP-11, I decided to do something interesting with it.  Drawing a fractal seemed to fit the bill, so I did a google search to see if anybody had managed to render the Mandelbrot Set in ASCII Art.  I found this Java code.  So I decided that I should port it to K&R C and see if it runs on the PDP-11.  This is the result:

Mandelbrot in ASCII

Very not bad!  And if you're interested, the K&R version came out like this:

#include <stdio.h>

/* CC
      mandel.c/A
   link mandel.obj,c:suport.obj,c:clib.obj
*/

main()
{
  float b,e,r,n,d;
  int h,c;
  for(e=1.1; e>-1.2; e-=.1)
  {
    for(b=-2; b<1; b+=.04)
    {
      if ((++c % 76)==0) printf("\r\n");
      else printf("%c",h);
      n=0;
      h=127;
      for(r=0; r*r+n*n<4 && --h>32; d=r)
      {
        r = r*r-n*n+b;
        n = 2*d*n+e;
      }
    }
  }
}

So far this has only been done in SIMH, but when I have made a physical 5.25" boot disk I will try it on the real machine.  I'm interested to know how fast (or slow) it is...