Mind-bending self-replicating GIF code prints an exact copy of itself, is both a program and its own visual output — champion coder shows off 'Piet Quine' technique
A champion coder's latest confection is a Piet Quine – a GIF image that prints itself byte-for-byte.
Champion programmer Yusuke Endoh has created a fascinating Piet Quine, a GIF that simultaneously acts as the source code and its visual output. This extraordinary feat merges the concepts of Piet, an esoteric programming language that generates colorful, tile-based artwork, and Quine, a program that independently reproduces its own code without external input.
In this unique composition, the GIF undergoes a 'load data' phase, followed by a thorough examination of the GIF file header and palette information. The main challenge lies in the incorporation of binary data, compression, and an intricate flow that must be carefully handled to achieve the desired result. Notably, the source image consists of two distinct parts: a data section compressed via adaptive run-length encoding, and a code segment.
Endoh initially managed to accomplish this creation in 2009, but the resulting GIF was excessively tall, making it unsuitable for visual appreciation. To rectify this issue, Endoh enlisted the assistance of Claude Code, an AI system, to analyze and reconstruct the original script and craft a more compact 'landscape' Piet Quine. After extensive refining and optimization, the final product emerged, neatly fitting into a 4:3 landscape image with dimensions of 252 x 189 pixels.
This remarkable achievement is driven by Endoh's desire to raise awareness of the 2026 Obfuscated Programming Language Design Contest, which is currently ongoing. The contest invites participants to design an esoteric programming language and submit their creations, with Endoh serving as one of the esteemed judges. The submission deadline is October 1, and interested individuals are encouraged to participate in this intriguing challenge.
Written by urgent.news from Tom's Hardware's reporting — not their text. Machine-written — it may contain errors, so check the original before relying on it.