How to Create Stunning 1024×1024 Images with Just Three 140‑Character C++ Functions
The Tweetable Mathematical Art contest asks programmers to craft three ultra‑short C++ functions—each under 140 characters—to generate a full‑resolution 1024×1024 image, and this article showcases several impressive submissions with their resulting graphics and code snippets.
The "Tweetable Mathematical Art" contest, launched by Kyle McCormick on StackExchange, challenges participants to generate a 1024×1024 image using only three C++ functions—RD, GR, and BL—each limited to 140 characters. Each function receives integer coordinates i and j (0 ≤ i, j ≤ 1023) and must return a value between 0 and 255 representing the red, green, or blue component of the pixel at (i, j). The three functions are inserted into a provided driver program to produce the final picture.
Below are several notable submissions, each accompanied by the resulting image and the corresponding code (shown as images).
Martin Büttner’s first artwork:
Code:
Martin Büttner’s second artwork:
Code:
A Mandelbrot fractal generated with only a few characters:
Manuel Kasten’s zoomed‑in Mandelbrot view:
Code:
Another piece by Manuel Kasten:
Code:
Submission from githubphagocyte:
Code:
Another work by the same author:
A diffusion‑limited aggregation image (code uses clever macro tricks to stay within the character limit):
Eric Tressler’s Feigenbaum bifurcation generated from a logistic map:
Code (also uses macro tricks to compress the implementation):
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
21CTO
21CTO (21CTO.com) offers developers community, training, and services, making it your go‑to learning and service platform.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
