The classic ASCII spinning donut, written Fortran
Scale = 1:
Scale = 3:
make
to compile (output binary isdonut.out
)make run
to compile and run
- Change the
scale
parameter to increase the size (You might have to decrease terminal font size accordingly) for "higher resolution" - Change the
speed
parameter to change the speed of the spinning - Anything else
Suggestions and improvements highly welcome :)
The performance difference between ifort
and gfrotran
is due to gfortran's lack of output buffering for non regular files. Program compiled with gfortran calls write for every character, which significantly decreases the performance.
Intel fortran compiler doesn't flush the output buffer until it enounters LF (\n
) character. Line 65 is added for this purpose
https://www.a1k0n.net/2006/09/15/obfuscated-c-donut.html
https://www.a1k0n.net/2011/07/20/donut-math.html
https://gist.github.com/gcr/1075131
https://github.com/RandomThings23/donut/blob/main/donut.c