Below are two textboxes. The one on the left is for input, and the one on the right displays output.

The goal here is to write a series of commands on the left that results in output matching exactly what's on the left.

In the world of programming, such a series of commands is called a quine

The commands available to you are:

In both commands, M is a whole number (e.g. 0, 1, 2, ...)

In the repeat command, N is a natural number (e.g. 1, 2, 3, ...)

Yes, such a quine is possible, and no, I won't tell you what it is. Only one command per line, please.


print 2 print 3 print 4 repeat 1 1
print 3 print 4 print 4
print 0 print 2 print 1 print 2 repeat 3 2
print 1 print 2 print 1 print 2 print 1

More info:

The set of print/repeat commands is based on the LZ77 decompression scheme used in ZIP file decompression. Basically, all ZIP files consist of opcodes that represent these commands, and because a quine exists for them, it's possible to create a ZIP file that unzips to... itself. Cool beans.

I found this exact puzzle a couple years ago, but have since been able to find it again. I thought it was interesting enough to merit a couple hours of hacking to recreate, and so here we are!

For those interested in learning more about this quine, here are a couple blog posts on the topic:

The source for this page is on Github at wgreenberg/quine.zip.

The colorscheme for this page is based on Ethan Schoonover's awesome Solarized palette which is licensed under the MIT License.