Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [quine]

A quine is a program which produces its source as output. This tag indicates that the challenge is related to quines.

16
votes
10answers
756 views

Q​u​i​n​e R​e​l​a​y​!

Quine Relay! A quine relay of order \$n\$ is a series of programs \$P_1\dots P_n\$ in distinct languages such that each program \$P_i\$ outputs \$P_{i+1}\$ and \$P_n\$ outputs \$P_1\$. For example, ...
9
votes
0answers
437 views

Make a Radiation Hardened Quine

Last night I was looking for the Radiation Hardened Quine challenge, but I couldn't find it. Turns out no one has asked it yet! So here it is: Your task is to make a quine, that is a non-empty ...
1
vote
0answers
78 views

Help us escape the quine factory! Put messages into quines [duplicate]

I've been enslaved in a quine factory. The other workers and I can't communicate with the outside world, we can only slave away making quines all day. The masters will reject any work that isn't a ...
30
votes
13answers
4k views

2 Cats in a Quine

Challenge Make two programs, A and B, which are both cat programs in the same language. When concatenated, AB (also in the same language) should be a quine. For example, suppose ...
19
votes
7answers
1k views

Rolling Quine Dice

Create a program that outputs itself. However, if the source code is repeated n times (meaning to concatenate a copy of the source code to the end n-1 times), then there should be 1/n probability ...
11
votes
0answers
215 views

quine program in C using only macros [closed]

Asked on Stack Overflow, but they suggested to move it here A while ago I was reading about quines. It made me wonder if it possible to write a macro in C which will print itself, without writing any ...
21
votes
10answers
1k views

Write a Quine Suite

We've had a lot of quine challenges, but a lot of the quine formats are similar, lets create some variance in our quines. Your task is to create a selection of programs in the same language (at least ...
12
votes
1answer
593 views

Auto cycler quine

Make a quine but with a twist. Statement The quine prints its code but puts its first character at the end. (You can do it in reverse but include that note in your answer) The output must then be a ...
10
votes
5answers
528 views

Quine of orders

Write a program that, when run in different languages, outputs a different byte permutation of the code in each language. The exact source code is counted as one permutation. Here "different language"...
6
votes
3answers
230 views

Intron Adder Quine

In the context of quines, an intron (or payload) is a part of a quine that serves no purpose in producing output, but is still included in the data section. For example: ...
9
votes
4answers
247 views

Ticking Quine-Bomb!

Challenge: Create a program or function that takes an integer input, which outputs a new program/function as specified below. Input: Integer n: Time in seconds ...
37
votes
25answers
4k views

Self-growing code codee codeee codeeee

Write a program (or function) (let's call it P1), that when run, outputs another program P2 of the same language and exactly 1 byte longer than P1. Program P2 when run, should output a 3rd program P3 ...
18
votes
4answers
872 views

Build a half cardinal cyclic quine

A half cardinal cyclic quine is a cyclic quine with two states, one perpendicular to the other. Rules You can decide which rotation you want to implement, clockwise or counter-clockwise. Once ...
3
votes
1answer
248 views

Turn Your Program into a Snake! [duplicate]

...or "snakes but not too long". Inspired by this challenge and this comment. Task Write a program or a function that takes no input and outputs its own source code formatted as a snake according ...
28
votes
18answers
5k views

Take a stand against long quine lines

or: Build a vertical quine Inspired by Take a stand against long lines. Your task is to build a vertical quine with as short a line length as possible. Scoring Shortest line length (excluding ...
18
votes
9answers
700 views

The NX source-length problem [duplicate]

On PPCG, we have had lots of challenges where the length of your output is dependent on the length of your source code. For the purposes of this challenge, we will call these Source-length problems. ...
5
votes
4answers
260 views

Program Sequence Generator

Your challenge is to implement a cyclic Program Sequence Generator (PSG) in a language of your choice. Given a language, L, a PSG in L is a program in L that outputs a PSG in L. Some properties of a ...
18
votes
7answers
1k views

Russian Nesting Quine

A Russian nesting doll, more commonly known as a Matryoshka doll, is a doll which contains a smaller version of itself, which then contains another smaller version of itself, which contains a smaller ...
25
votes
6answers
834 views

Mutually Exclusive Quines

Your challenge is simple. Write two programs that share no characters which output each other. Example Two programs P and Q are mutually exclusive quines if: P outputs Q Q outputs P There is no ...
10
votes
1answer
235 views

Cyclic Weak Levenquine

This question asking us to make a "Cyclic Levenquine" has gone unanswered. So today we will ask a slightly simpler version. In this challenge we will define a K-Levenquine to be a program whose ...
20
votes
11answers
3k views

Is it a substring of itself?

Given a string, return whether the string is a substring of the program's source code. Standard quine rules apply, meaning you cannot read your own source code. The length of the input is guaranteed ...
18
votes
8answers
1k views

Output the Source, One Bit at a Time

Write a non-empty program or function that when called outputs a single value, 1 or 0, and when called multiple times, the output numbers produce the binary representation of your program's source ...
11
votes
6answers
716 views

Invert a Quine!

We all know what a quine is. An inverted quine is a non-empty program that prints the inverse of its source code without reading its source code, and consists solely of printable-ASCII characters (...
5
votes
6answers
447 views

A Complementary Quine

Write a quine that outputs the complement of the source code from the smallest containing power of two. Here's an example: IN : source OUT: \r\x11\x0b\x0e\x1d\x1b ...
7
votes
4answers
658 views

Unfurling-Safe Quine

Write a proper quine containing at least one newline/linefeed whose every unfurling is either itself a proper quine or outputs the original quine. Your answer can mix and match outputting itself and ...
9
votes
7answers
753 views

Code-Golf Assembly Line

Note: This challenge has nothing to do with actual assembly language. As the head of Code-Golf Factory Inc., you must create an assembly line to generate a specific piece of code. Today, the foreman ...
15
votes
19answers
1k views

Generate programs that print n times their length

Given a nonnegative integer n, your solution must output a program in your chosen language whose output has n times as many ...
9
votes
3answers
406 views

Levenshtein Your Source

The Levenshtein edit distance between two strings is the minimum possible number of insertions, deletions, or substitutions to convert one word into another word. In this case, each insertion, ...
12
votes
12answers
670 views

Travel Back in Quine

The challenge here is simple, and not at all about byte-count. Your job is to output the first 50 characters of the previous quine's source code, concatenated with the first 50 characters of yours ...
16
votes
40answers
2k views

Code point sum quine

All the quine challenges on this site are focused on byte count, or the characters themselves. This one is different. Your challenge is to write a program that produces output which has a code point ...
45
votes
5answers
1k views

TryItOnquine Challenge

(based on this post and the ensuing discussion on chat -- also, much thanks to Dennis for TIO!) The Challenge Choose a language that's currently available on the TryItOnline site, for example ...
4
votes
7answers
719 views

Make a base64 Quine!

Your challenge is to output a Base64-encoded version of your source code, and optionally a line break. You must output the correct padding, if any. Standard quine rules apply, shortest answer wins. ...
13
votes
1answer
524 views

Mutation-hardened quine

Your task is to make a program that prints out its own source. "Hey, we already have this challenge, and tons of variations of it! Why are you making another one?" you may ask, but this one is going ...
13
votes
2answers
397 views

Cyclic strings, hidden programs

Write 3 programs that do the following task: Let A, B, C source codes of those three programs; if A runs BC is produced as output, if B runs CA is produced, if C runs AB is produced; so each ...
15
votes
4answers
497 views

Quining a Pristine World

This challenge is based off of Helka Homba's question Programming a Pristine World. From that question, the definition of a pristine program is: Let's define a pristine program as a program that ...
2
votes
4answers
179 views

Write a Stepping Quine

Related Your goal, is to write a set of programs, that progresses from one to the other, one character at a time. For example. Given the starting program abcd and ...
10
votes
11answers
2k views

Tri-interquine - Three programs that output each other in a loop

Related: Interquine Program A outputs program B's code when run, and B outputs C's source, and C outputs A's source. This time you can't exchange two characters and exchange again :) Requirements: ...
29
votes
20answers
4k views

Interquine - Two programs that output each other in a loop

Program A outputs program B's code when run, and B outputs A's source. Requirements: Only one language across both programs Programs are different. One program that outputs itself does not qualify. ...
1
vote
1answer
190 views

Quine over network [closed]

Write a program, that sends its own source code over network. Network example is TCP/UDP or web socket. Ethernet, Bluetooth, Wi-Fi and internet over USB are allowed. No need to write receiver ...
5
votes
1answer
229 views

ASCII Reverse Quine

Okay, so everyone is familiar with the ASCII-table, correct? I'd hope so. I've been going to that site for my asciitable reference for as long as I can remember needing one. We'll be doing some fun ...
23
votes
38answers
2k views

Golf an Anagram Quine

In this question I asked you to guess an anagram quine based on its output. However it looks like we don't have a question asking to golf an anagram quine yet. So your task will be to make the ...
4
votes
1answer
290 views

Insert a simulated Ken Thompson virus into a program

A Ken Thompson virus is a virus that infects your compiler and other programs. Since it infects all your tools, you can not detect it without using tools from before the virus was introduced. Your ...
5
votes
4answers
240 views

Let's get the gang back together! [closed]

A narcissist program is a program that only accepts its own source code. A bigotous program is a program that only accepts the source code of programs semantically equivalent to itself. A gang member ...
12
votes
0answers
319 views

Make a quine writer! [closed]

Writing quines is hard. Why not have your computer write them for you! Your program will take as input an interpreter (in a Turing complete language of your choosing) for a language X, and you will ...
8
votes
1answer
249 views

Create a Muriel-like language and implementation

Muriel is a language where the only way to loop is to create a quine and execute it. Your job is to create your own language with this property and an implementation of it in a pre-existing language. ...
8
votes
0answers
224 views

Radiation hardened cyclic quine polyglot

Challenge Write two programs that: run in two different programming languages. These may not be two versions of one language. when one program is run, it outputs the second program, and vice versa....
11
votes
2answers
337 views

Quine/Error Quine Polyglot

Your task is simple: Write a program that can be run in two languages. It should be a normal quine (prints its own source code) in language 1, and should be an error quine (generates an error message ...
12
votes
7answers
1k views

Golf you an anagram for great good!

The Task In this challenge, your task is to write some code which outputs one of its anagrams chosen randomly with uniform distribution but it should never output itself. Elaboration Given no input,...
8
votes
6answers
899 views

It's Anagram Quine, not just Quine!

The Task In this challenge, your task is to write a program, which takes in no input, with as many anagrams that are quine of themselves as possible. Your score will be the number of anagrams of ...
18
votes
1answer
387 views

Rotation-safe quine

Write a proper quine whose every rotation is itself a proper quine. For example, if your source code is abcdef, then: abcdef ...