4 ms·
Fractals can be drawn by surprisingly small amounts of code. For example, this mandelbrot fractal is implemented in 122 characters of JavaScript: https://www.dw
by iverjo 10y ago
Fractals can be drawn by surprisingly small amounts of code. For example, this mandelbrot fractal is implemented in 122 characters of JavaScript:
https://www.dwitter.net/d/123 https://www.dwitter.net/d/123
I wouldn't be surprised if the burning ship fractal could be coded on dwitter (i.e. with 140 characters or less) as well
- quarterto 10y agoJust need to add a Math.abs: https://www.dwitter.net/d/457 https://www.dwitter.net/d/457
- deleted 10y ago[deleted]
- vog 10y agoNice, but you don't need Math.abs to stay within the 140 chars limit: t?i++:i=0;for(j=1080;j--;){a=b=0;k=35;for(;k--&&a*a+b*b<4;)c=a*a-b*b+i/540-2,b=2*(a*b<0?-a*b:a*b)+j/540-1,a=c;x.fillRect(i,j,1,S(k/9))}
- AceJohnny2 10y agoWhen working on an SoC over 5 years ago, we'd have it display the company logo on screen upon boot. While not necessary for the test, it was really useful to see if the system reached that boot stage. As an afternoon exercise, I wrote a Mandelbrot draw function (my first fractal display code!). Then I realized it was both faster and used less code and runtime memory than the image display stuff, so I replaced it in my environment. Other people were amused by it, so it went in public repository. A couple weeks later, someone removed it to reinstate the image display. I guess having the company logo for internal-only code was more important to someone :( I don't work there anymore.
- userbinator 10y agoEven better if your company's logo is a fractal: https://en.wikipedia.org/wiki/File:American_Megatrends_Logo.svg https://en.wikipedia.org/wiki/File:American_Megatrends_Logo.... If I remember correctly, early AMIBIOS did generate that logo procedurally using a short piece of code.