Skip to content

Instantly share code, notes, and snippets.

@lemieuxster
Created April 27, 2011 16:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lemieuxster/944568 to your computer and use it in GitHub Desktop.
Save lemieuxster/944568 to your computer and use it in GitHub Desktop.
JavaScript Mandlebrot ASCII Art
/* Ported from Java which was ported from Python. I can't recall the original author */
function generateMandlebrot() {
var b,e,r,n,d,h,out="";
for(e=1.1;e>-1.2;e-=.1)for(b=-2;b<1;b+=.04,out+=(String.fromCharCode(b>1?10:h)))
for(r=n=0,h=127;r*r+n*n<4&&--h>32;d=r,r=r*r-n*n+b,n=2*d*n+e);
return out;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment