Skip to content

Instantly share code, notes, and snippets.

@rogerkenny
Last active February 22, 2016 17:34
Show Gist options
  • Save rogerkenny/a12922dcc6876dcef545 to your computer and use it in GitHub Desktop.
Save rogerkenny/a12922dcc6876dcef545 to your computer and use it in GitHub Desktop.
I challenged myself to write a tweetable one-line Mandelbrot set, and this is the result. 135 characters long, generates an ascii art Mandelbrot.
o='',s=0.02;for(l=-1;(l+=s)<1;){for(k=-2;(k+=s)<1;){for(x=y=0,j=99;x*x+y*y<4&&--j;){a=x*x-y*y+k,y=2*x*y+l,x=a}o+=j?'#':'_'}o+='<br>'};
document.write(o);document.getElementsByTagName('html')[0].style.lineHeight = 0.5;
@rogerkenny
Copy link
Author

Ok, I cheated a little by breaking out the code that outputs the set to the browser and formats it a little better into a second line. Any suggestions on how to fold that into the 140 character limit would be much appreciated.

@rogerkenny
Copy link
Author

Copy and paste the gist into any random browser js console.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment