Stack Exchange Network

Stack Exchange network consists of 175 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.

-1
votes
2answers
265 views

A poly-moly-holy quine. (Well, it's not, but the title's cool.)

This is an answer chaining puzzle, where each answer must add on to the last. The nth submission must output its own source code in the nth language and the n-1 languages before it. A language can ...
-2
votes
5answers
261 views

45 degree quine [closed]

A very simple golf this time, but should be fun to do. Challenge Output your code, but rotated 45 (or -45) degrees. E.g: lorem ipsum dolor sit amet becomes <...
-3
votes
2answers
225 views

Invert your code [closed]

Challenge Return the full contents of your program, but inverted. How do your invert something? Well, Letters: Take the position of the letter in the alphabet, subtract from 26, and use the letter ...
11
votes
9answers
392 views

The Great Pyramid of Quine

The task is a rather simple quine challenge with a twist, you must output your source code in the shape of a pyramid. The shape of a pyramid is defined below: ...
21
votes
3answers
1k views

Meta-bowling Golf

Your task is to create the shortest program (A) that outputs another program (B) with the most unique bytes, which in turn outputs the original program (A). Essentially, you are golfing one half of a ...
16
votes
7answers
2k views

Write the longest period iterating quine bounded by 500 bytes

Your job is to create the longest period iterating quine, where the length of each program in the sequence is bounded by 500 bytes. That is, if you repeat the following steps: Start with your ...
5
votes
0answers
184 views

Radiation is Painful

A radiation-hardened quine can take a hit and stay standing, but nobody ever said that the quine can't be a wuss about it. For this challenge, you should write a quine that: If no characters are ...
2
votes
0answers
110 views

Heart-shaped quine [closed]

As you may or may not know, Valentine's day is getting close. So today, my task for you is: Write a heart-shaped quine Rules: Code should look like an identifyable heart shape, i.e. Has two round ...
10
votes
13answers
1k views

Quine outputs itself in binary

Your task, if you wish to accept it, is to write a program that outputs its own source code in the binary UTF-8 representation. Rules The source must be at least 1 byte long. Your program must not ...
5
votes
3answers
497 views

A Multipurpose Quine

I personally love quines, but they all seem to be so... static. So why not create a quine that can do more. Challenge The challenge here is to create a quine that without any sort of input is a ...
7
votes
1answer
220 views

A Radiation Hardened Palindromic Quine

There are radiation hardened quines, palindromic quines, but has anyone tried both?! I think not! Rules So the challenge here is to make a quine that if any symbol is deleted it prints its original ...
1
vote
1answer
218 views

Pumping quine radix

Inspired (you don't need to know them for this challenge) by the Pumping Lemma for various languages, I propose the following challenge: choose some basis \$B \geq 2\$ and an integer \$n \geq 0\$ ...
3
votes
2answers
231 views

Special quines and code golf, hooray!

Make a quine. Simple enough, except it has to be a palindrome and accept input. Now, any side of a palindromic quine is one half of it. For example, one side of the hypothetical quine AAAA is AA. One ...
3
votes
13answers
350 views

Create a kind of quine, such that the program prints one character of itself, then two, then three and so on

Create quine variant such that the program prints its first character, then the first two, then three and so on until the whole program is printed. Example Suppose your code is ...
16
votes
10answers
818 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, ...
13
votes
1answer
586 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
83 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 ...
31
votes
14answers
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 ...
20
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
251 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 ...
30
votes
12answers
2k 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
606 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
565 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
236 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
257 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 ...
40
votes
26answers
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
878 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
259 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
708 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
278 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 ...
27
votes
6answers
926 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
279 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 ...
21
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
731 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
664 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
767 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 ...
16
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
411 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
686 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 ...
17
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 ...
47
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
756 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. ...
14
votes
1answer
566 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
403 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 ...
16
votes
4answers
524 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
182 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 ...