Here on the left is a spinning ASCII donut, and on the right is the donut shaped C code by Andy Sloane that generates it. Now, with syntax highlighting. Now I recommend you check out Andy’s blog post on the mathematics behind a flying spinning torus AKA donut. The link to the post is in the description. The basic steps are: create a circle, then create a torus by rotating the circle about the y-axis, then using rotation matrices, spin the donut around the x and z axes. Finally, project the donut onto the 2D screen, adding illumination by calculating the surface normal after picking a particular light source. The cool thing is because this is ASCII world, there’s different characters associated with different levels of luminance. We can go back to the deobfuscated version of the code that I generated, added a microsecond sleep function to aid in the animation. Compiling and running the code, we’ll get our spinning donut. There’s a lot of parameters you can control with this donut, including the field of view and the distance of the donut from the viewer. I spent at least and hour every day learning and exploring outside my main line of work so I thought it’d be cool to, uh, start throwing together quick little videos about things that I find beautiful, whether they’re basic or advanced in the world of machine learning, math, computer science, programming, psychology, whatever- even biology, physics, history, and philosophy. So, hope this is, uh, a value, fun, and something you would enjoy.