Jump to content

Mandelbrot set: Difference between revisions

Added Obfuscated C implementation for producing the ASCII Mandelbrot Set.
(Added Obfuscated C implementation for producing the ASCII Mandelbrot Set.)
Line 1,556:
return 0;
}</lang>
===ASCII===
Not mine, found it on Ken Perlin's homepage, this deserves a place here to illustrate how awesome C can be:
<lang C>
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;
j=r*r-i*i-2+x/25,i=2*r*i+y/10,j*j+i*i<11&&k++<111;r=j);}
</lang>
There may be warnings on compiling but disregard them, the output will be produced nevertheless. Such programs are called obfuscated and C excels when it comes to writing such cryptic programs. Google IOCCC for more.
<pre>
.............::::::::::::::::::::::::::::::::::::::::::::::::.......................
.........::::::::::::::::::::::::::::::::::::::::::::::::::::::::...................
.....::::::::::::::::::::::::::::::::::-----------:::::::::::::::::::...............
...:::::::::::::::::::::::::::::------------------------:::::::::::::::.............
:::::::::::::::::::::::::::-------------;;;!:H!!;;;--------:::::::::::::::..........
::::::::::::::::::::::::-------------;;;;!!/>&*|I !;;;--------::::::::::::::........
::::::::::::::::::::-------------;;;;;;!!/>)|.*#|>/!!;;;;-------::::::::::::::......
::::::::::::::::-------------;;;;;;!!!!//>|: !:|//!!!;;;;-----::::::::::::::.....
::::::::::::------------;;;;;;;!!/>)I>>)||I# H&))>////*!;;-----:::::::::::::....
::::::::----------;;;;;;;;;;!!!//)H: #| IH&*I#/;;-----:::::::::::::...
:::::---------;;;;!!!!!!!!!!!//>|.H: #I>/!;;-----:::::::::::::..
:----------;;;;!/||>//>>>>//>>)|% %|&/!;;----::::::::::::::.
--------;;;;;!!//)& .;I*-H#&||&/ *)/!;;-----::::::::::::::
-----;;;;;!!!//>)IH:- ## #&!!;;-----::::::::::::::
;;;;!!!!!///>)H%.** * )/!;;;------:::::::::::::
&)/!!;;;------:::::::::::::
;;;;!!!!!///>)H%.** * )/!;;;------:::::::::::::
-----;;;;;!!!//>)IH:- ## #&!!;;-----::::::::::::::
--------;;;;;!!//)& .;I*-H#&||&/ *)/!;;-----::::::::::::::
:----------;;;;!/||>//>>>>//>>)|% %|&/!;;----::::::::::::::.
:::::---------;;;;!!!!!!!!!!!//>|.H: #I>/!;;-----:::::::::::::..
::::::::----------;;;;;;;;;;!!!//)H: #| IH&*I#/;;-----:::::::::::::...
::::::::::::------------;;;;;;;!!/>)I>>)||I# H&))>////*!;;-----:::::::::::::....
::::::::::::::::-------------;;;;;;!!!!//>|: !:|//!!!;;;;-----::::::::::::::.....
::::::::::::::::::::-------------;;;;;;!!/>)|.*#|>/!!;;;;-------::::::::::::::......
::::::::::::::::::::::::-------------;;;;!!/>&*|I !;;;--------::::::::::::::........
:::::::::::::::::::::::::::-------------;;;!:H!!;;;--------:::::::::::::::..........
...:::::::::::::::::::::::::::::------------------------:::::::::::::::.............
.....::::::::::::::::::::::::::::::::::-----------:::::::::::::::::::...............
.........::::::::::::::::::::::::::::::::::::::::::::::::::::::::...................
.............::::::::::::::::::::::::::::::::::::::::::::::::.......................
</pre>
 
=={{header|C++}}==
503

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.