Skip to content
DevMeme
1592 of 7435
Thanos on Recursive Code Art
Languages Post #1780, on Jul 15, 2020 in TG

Thanos on Recursive Code Art

Why is this Languages meme funny?

Level 1: Donut Makes Donut

Imagine you have a magic recipe card for making donuts, and the recipe itself is written in the shape of a donut. When you follow this donut-shaped recipe, you end up baking… a real donut! It sounds silly, right? You basically used a donut-shaped set of instructions to create an actual donut. That’s exactly the kind of playful loop happening here. In the meme, a piece of computer code (like a recipe for a computer) is arranged to look like a donut, and when the computer runs it, it draws a picture of a donut. It’s funny and satisfying in the same way as if a donut was used as a stamp to print another donut. It makes us laugh because it’s so perfectly matched: the thing (the code) looks just like what it makes (the donut image). It’s like a little inside joke that came full circle – literally a circle, because, well, donuts are circles! Even if you don’t get all the tech stuff, the idea of “using the donut to create the donut” is a goofy, magical-sounding trick that anyone can smile at.

Level 2: Terminal Torus Trick

Alright, let’s break down what’s going on here in simpler terms. The meme has two parts. The top part looks like a YouTube video thumbnail with a split-screen image. On the left side of that image, you see a donut shape drawn in text characters – basically an ASCII art donut. ASCII art means making pictures using the normal letters, numbers, and punctuation you see on a keyboard. So imagine a donut drawn with lots of dots, commas, semicolons, and other symbols. On the right side of the top image, you see what looks like a bunch of colored coding text in the C programming language, and interestingly, that code text itself is arranged in a big circle – precisely the shape of a donut. So the two halves together show: a donut-shaped image made of text, and donut-shaped C code that (we’re told) generates that image. Beneath this thumbnail, there’s a video title “Donut-shaped C code that generates a 3D spinning donut – 45K views.” It’s mimicking how a cool programming demo might be presented on YouTube to intrigue viewers.

Now the bottom part of the meme shows a scene from a famous Marvel movie (Avengers). It’s the villain Thanos looking weary but satisfied, with a caption: “I used the donut to create the donut.” Both instances of the word “donut” are highlighted for emphasis. This is a play on a line from the movie where Thanos says “I used the stones to destroy the stones.” In the movie, he’s referring to powerful Infinity Stones. The meme replaces “stones” with “donut” to fit our coding joke. So basically, it’s making Thanos seem like he’s proud of this crazy programming feat of using a donut-shaped program to create a donut image. It’s an over-the-top dramatic way to state what’s happening in the top panel.

So why is this funny or interesting? Let’s break the key points down:

  • C Program (donut.c): C is a programming language known for being very close to the computer’s metal (lots of manual control). The snippet of code shown (with things like main(){float A...} or memset(b,32,1760)) is actually from a small C program that outputs a rotating donut shape in text. This is a known fun demo among programmers. When you run the program in a terminal (the text-based window where you type commands, also called a CLI – Command Line Interface), it prints a donut that seems to spin around and around. It does this by printing frames composed of ASCII characters (like letters and punctuation) many times a second, erasing and redrawing to animate it. Kind of like an old cartoon flipbook, but with text characters as pixels.

  • ASCII donut output: The left side of the top image shows the kind of output that program produces: an ASCII torus (torus is just the math/geometry term for a donut shape). You can actually see the donut’s hole and the shading on it, all made from characters like . , ; etc. The reason you see different characters is that the code calculates which parts of the donut are facing the light or camera and uses different symbols to represent brighter or darker areas (for example, maybe using @ or # for the brightest spots and . for the dimmest). This gives a 3D look using just text.

  • Donut-shaped code: Normally, source code is written in straight lines, top to bottom. Here, someone had the fun idea to format the code itself in the shape of a donut for the image. They likely took the actual code (which would usually just look like a bunch of lines) and manually arranged the words and symbols so that they curve around forming a ring. It’s like writing a paragraph in a circular shape. This doesn’t affect the code’s functionality at all – it’s just a visual gimmick – but it makes the code look like the donut it creates. That’s why the video title calls it “Donut-shaped C code... generates a 3D spinning donut.” It’s a visual pun: both the code and its output are donuts!

  • The Thanos quote: The bottom panel’s text “I used the donut to create the donut” is both a movie reference and a summary of the joke. In Avengers: Endgame, Thanos uses the all-powerful Infinity Stones to destroy those same stones so they can’t be used again, which is kind of a mind-bending self-referential act. Here, by analogy, the coder “used a donut (shaped code) to create a donut (the ASCII graphic).” It’s a funny exaggeration because making a spinning text donut isn’t exactly saving the universe – but the meme humorously treats it with the same gravity as a moment from a superhero epic. The highlighted donut words make sure you notice the substitution.

  • Why it’s a triumph (for nerds): To a non-programmer, this might just look like gibberish arranged in a circle and some weird text picture. But to programmers, especially those who have dabbled in C or terminal tricks, this is legendary. It’s like a clever magic trick: writing a short program that does something visually cool with basically no graphics. It shows off some old-school creativity. The fact that the meme author literally shaped the code like a donut is just showing off the self-referential aspect even more – it’s very “meta” (meaning it’s a reference to itself). This kind of humor – referencing code within code, or making something refer to itself – is very common in DeveloperMemes and appeals to the coder mindset. We like recursive jokes, patterns, and, yes, even ASCII art nostalgia.

  • CLI Graphics: There’s an extra layer of fun in that this is happening in a terminal. Today, we have fancy GUIs and high-resolution graphics, but there’s a certain retro charm in making graphics out of text like it’s the 1970s or 1980s. Older developers remember things like text-mode games or BBS ASCII art, so a spinning ASCII donut hits a sweet spot of TerminalHumor. It’s the kind of thing you might run to prank a friend or just marvel at for a minute: “Wow, my terminal is showing a 3D donut!”

In summary, for a newcomer: The meme shows a cool C program that draws a donut with text. The code is cheekily shown in a donut shape itself. And the caption jokes that the donut (code) was used to create the donut (output), quoting a famous movie villain to playfully exaggerate how proud one might feel about this nerdy achievement. It’s funny because it’s both a clever programming feat and a silly self-referential joke — a perfect mix for coding enthusiasts who love both coding humor and a dash of Marvel movie flair.

Level 3: Full Circle Coding

The humor of this meme operates on multiple layers that seasoned developers and nerds will appreciate. First, it highlights a legendary C demo often known simply as “donut.c” – a program that many of us have encountered in programming folklore or online forums. This program is a rite of passage in a way: it’s one of those clever code treasures that show how to do a lot with very little. It produces an animated ASCII donut in the terminal, rotating in real time. For a generation of programmers, seeing this for the first time feels like witnessing a magic trick: “How on earth is a mere sequence of text characters in a console creating the illusion of a spinning 3D object?!” The answer, of course, lies in the trigonometry and manual buffer manipulation, but at face value it’s just so delightfully absurd and ingenious.

Now, the meme takes this beloved piece of coding humor and cranks the meta level to 11. The top panel is styled like a YouTube video thumbnail with the title “Donut-shaped C code that generates a 3D spinning donut.” It literally shows the phenomenon of code-as-art: the source code itself (on the right) has been arranged in the shape of a donut, and the output (on the left) is that familiar ASCII donut display. This visual gag “I used the donut to create the donut” is a direct nod to a famous line from Marvel’s Avengers: Endgame. In the film, supervillain Thanos says dramatically, “I used the stones to destroy the stones,” referring to using the Infinity Stones’ power to eliminate those same stones. The meme punchline alters this to “I used the donut to create the donut,” highlighting the self-referential loop: the donut-shaped code produces a donut image. This is a perfect blending of geek cultures – Marvel cinematic universe references colliding with esoteric programming jokes. A seasoned dev likely chuckles because it’s an unexpected crossover: who would imagine a CLI ASCII art demo and a cosmic supervillain quote coming together so perfectly?

Importantly, the phrase “I used the donut to create the donut” emphasizes recursion and self-reference, concepts near and dear to experienced programmers. It’s reminiscent of things like a compiler that compiles its own source code, or a quine (a program that outputs its own source). While the donut.c isn’t exactly printing its source code, it’s printing an object that’s conceptually the same shape as its source’s layout in the meme. It’s a playful form of code art, almost like the program is looking in a mirror. This self-referential humor tickles the part of a programmer’s brain that loves elegant loops and circular logic (pun intended — donuts are circles, after all!).

From a senior dev perspective, there’s also some nostalgia here. The donut.c code has been around for years (traces of it go back to early forum posts and the demo scene), often passed around with a sense of “check out this cool hack.” It calls back to an era of programming where you might write games or demos for the terminal or very limited display environments, meaning you had to be incredibly clever with text and math. Seeing it resurface in a meme, formatted as a trendy YouTube video screenshot with “45K views,” is hilarious because it suggests this geeky inside joke has gone mainstream viral. It’s as if our little inside secret made it to prime time. The Languages category tag fits because this is about C code; CLI because the action happens in the command-line terminal window; Graphics because, well, it’s doing graphics in a very unorthodox way. It also slyly comments on how timeless certain coding tricks are: fancy new tech comes and goes, but a tight C program from decades ago can still captivate and amuse developers today. In an age of gigabyte-scale game engines and GPU shaders, here we have a tiny ASCII donut spinning in a humble terminal, and it still brings a smile.

The bottom panel featuring battle-worn Thanos delivers the final comedic blow. In the movie scene, he’s just accomplished a heavy, paradoxical task (using the Infinity Stones to destroy themselves) at great personal cost. Transplanting that solemn line to a cheeky programming context makes it absurdly grandiose. It’s like saying, “Behold my ultimate achievement: I have written donut-shaped code to produce a donut!” The over-the-top seriousness of the quote contrasts with the silliness of the scenario, which is classic developer meme style—taking something trivial (like an ASCII art demo) and describing it in epic, triumphant terms. Every senior dev who has spent a late night tinkering with fun code like this feels a bit like Thanos-in-the-shadows when it finally works: exhausted but triumphant, “Fine, I’ll do it myself” energy. And highlighting both instances of donut in the caption visually connects the cause and effect, just as in Thanos’s original quote both instances of “stones” signified cause and effect. This visual emphasis makes sure we don’t miss the joke: the donut (code) was used to create the donut (output).

In short, this meme hits all the right nerd buttons: a dash of meta_meme cleverness, a beloved code demo from the past, and a sprinkle of pop culture. It’s a celebration of how creative and self-referential programming culture can be. The triumph in the title “self-referential rendering triumph” is tongue-in-cheek, as though this silly hack is some grand achievement. And in a way, to programmers, it kind of is—not because it changes the world, but because it’s a perfect loop of creativity that only our tribe might attempt. We’re laughing both at the absurdity and in admiration. The meme says: Yes, we really are the kind of people who use a donut to create a donut, and we’re absurdly proud of it. 🍩

Level 4: Parametric Pastry Projection

At the most technical level, this meme celebrates a mini-marvel of graphics programming in C: a program that renders a spinning 3D donut using only text. Under the hood, the code generates a torus (donut shape) via parametric equations and projects it onto the terminal screen. A torus can be described mathematically by two angles—one for going around the donut’s hole (like walking in a circle around the center) and one for the circular cross-section of the donut’s tube. In formula form, if we let $\theta$ and $\phi$ represent these angles, and choose some radii $R$ (distance from the center of the hole to the donut’s tube center) and $r$ (radius of the tube), a point on the torus surface in 3D can be given by:

$$ \begin{aligned} x &= (R + r \cos \phi)\cos \theta,\
y &= (R + r \cos \phi)\sin \theta,\
z &= r,\sin \phi~, \end{aligned} $$

where $\theta, \phi \in [0, 2\pi)$. The donut.c code computes these $(x,y,z)$ coordinates for many sample points (by looping over angles in small increments) to approximate the surface. Then it rotates the donut in real time by adjusting angles $A$ and $B$ (for two rotation axes) on each frame, effectively multiplying the coordinates by rotation matrices. This yields a moving 3D shape. Because we’re in a text console (no real graphics), the code implements a manual 3D rendering pipeline: it projects each 3D point onto a 2D grid (like flattening the 3D donut onto your screen) and determines the brightness at that point by computing a dot product between the surface normal and a light vector (i.e., basic Lambertian shading). The brilliance of donut.c is that it uses these brightness values to pick ASCII characters of varying density (e.g. . vs @) to simulate shading – lighter areas use brighter (denser) characters, darker areas use sparser ones. It even manually maintains a z-buffer (a depth buffer) in an array to keep track of which donut surface points are in front of others relative to the viewer. This ensures the ASCII donut has proper 3D depth cues: nearer parts overwrite farther parts in the output.

All of this math-heavy work happens with plain C standard library calls and a tight loop. The code snippet visible (arranged in a ring on the right half of the meme’s top panel) reveals clues of these internals: memset(b,32,1760) fills a character buffer b with the ASCII code 32 (a space ' ') for 1760 positions (which likely corresponds to a 80x22 character grid = 1760 characters, the text resolution of the donut). Similarly, memset(z,0,7040) might initialize the depth buffer z (1760 floats, perhaps 4 bytes each, giving 7040 bytes). There’s a call to sin() and cos(), and a mysterious putchar(k<80?b[k]:10); in some versions, which writes out either the character for each position or a newline (ASCII 10) every 80 characters to break lines. This tight coupling of math and memory manipulation is classic CFamilyLanguages wizardry: using low-level control of memory (via memset) and characters (via putchar) to manually rasterize a rotating shape. The code is essentially a tiny software renderer producing an ASCII art masterpiece.

What’s more, the code’s layout being donut-shaped in the meme is purely aesthetic—C doesn’t care about whitespace like that—yet it’s a playful nod to the concept of self-reference. It’s not quite a quine (a program that prints its own source), but it borders on metaprogramming humor: the source looks like the output it produces. In theoretical terms, it’s like a fixed point in the space of code and output where the shape of the code hints at the shape of the result. This touches on deep notions of representation and self-reference in computing (bringing to mind Gödel or quine programs, where a system encodes information about itself). Here, it’s less abstract: a torus of code produces a torus on screen—a visual fixed-point. It’s a triumph of clever math and ASCII artistry: by exploiting geometry and the properties of trigonometric functions, the programmer manages to conjure a dynamic donut from symbols, all with a few dozen lines of C. Not only is the algorithm ingenious, it’s also a throwback to earlier eras of computing when graphics had to be done in text mode on terminals. The result feels magical from a graphics programming perspective: using nothing but characters and math, the program tricks your brain into seeing a rotating 3D object. No OpenGL, no DirectX, just pure mathematics and memory – the essence of old-school CLI graphical hacks.

Description

A two-part meme combining a classic piece of programming folklore with a popular movie meme format. The top panel is a screenshot of a YouTube video titled 'Donut-shaped C code that generates a 3D spinning donut'. The video's thumbnail shows complex, obfuscated C code arranged in the shape of a donut on the right, and the resulting ASCII art donut it generates on the left. The bottom panel features a still image of the character Thanos from 'Avengers: Endgame' looking contemplative, with the subtitled quote, 'I used the donut to create the donut.' This is a clever re-contextualization of his original line, 'I used the stones to destroy the stones.' The joke is a meta-commentary on the code itself: the source code, which is shaped like a donut, is used to produce the output, a spinning ASCII donut. For experienced developers, this is an iconic piece of obfuscated code, and the meme humorously captures its perfectly circular and self-referential nature

Comments

7
Anonymous ★ Top Pick The original 'Infrastructure as Code' was just 'Donut as Code'
  1. Anonymous ★ Top Pick

    The original 'Infrastructure as Code' was just 'Donut as Code'

  2. Anonymous

    Donut.c is the only legacy system where the architecture diagram, the source, and the prod telemetry all render the same ASCII torus - when audit asked for docs, I just piped stdout into Confluence

  3. Anonymous

    After 20 years in the industry, you realize the real achievement isn't writing clean, maintainable code - it's convincing your PR reviewer that your donut-shaped, single-letter variable monstrosity is actually a legitimate performance optimization for embedded systems

  4. Anonymous

    The donut.c code is the ultimate flex: not only does it render a 3D rotating torus in pure ASCII using trigonometric projections and z-buffering in under 100 lines of C, but the source code itself is formatted as a donut. It's the programming equivalent of a self-portrait painted with a mirror - except this one compiles, runs at 60fps in your terminal, and has probably inspired more 'I should learn C' moments than any CS textbook ever written. The real kicker? The obfuscation isn't just for show; every character placement serves the dual purpose of aesthetic form and computational function, making it simultaneously a masterpiece of code golf and a meditation on the relationship between representation and reality in software

  5. Anonymous

    Donut.c: 3D graphics with zero deps and infinite smugness - beats WebGL demos that npm your soul

  6. Anonymous

    Donut-shaped C that prints a spinning donut - the rare quine whose fixed point is a torus and whose architecture literally embraces circular dependencies

  7. Anonymous

    Finally, a rendering pipeline where code style affects geometry - replacing the AST with an Abstract Syntax Torus

Use J and K for navigation