Questions tagged [quine]

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

Filter by
Sorted by
Tagged with
14
votes
9answers
2k views

Full name quine

Most Unicode characters have full names, for example is "RIGHT DOUBLE QUOTATION MARK". You can find a useful reference here, just type in the character ...
13
votes
13answers
625 views

Minimal distinct character quine

Your challenge is to construct a proper quine using as few distinct characters as possible. Scoring Your score is equal to the number of distinct characters in your code, aiming to minimise this. ...
6
votes
0answers
188 views

Build a program that outputs itself encoded as a QR [closed]

The goal is simple. Write a program that outputs itself encoded as a QR code. A QR code is a way to encode data in a black and white image, similar to a 2D image. An example implementation can be ...
15
votes
16answers
2k views

Hello, Permutations!

For this challenge, you will be required to write 3 programs: The first program should be a quine, i.e, it should print it's own source code. The second program should read the input and print all of ...
12
votes
2answers
393 views

Multiplying Quines

The program should start out with 2 separate files, here named "a" and "b". "a" and "b" should be what I am calling inverse quines: "a", when run, ...
17
votes
8answers
1k views

(Error) quines, hello world, polyglots, oh my!

Introduction A quine is a program that outputs its own source code. For example, a well-known Python quine is _='_=%r;print(end=_%%_)';print(end=_%_). Running it ...
1
vote
1answer
167 views

Simple “hyena” program [duplicate]

Write a program that takes a string as an input. For the input: If the input doesn't match the source code, the program shall output the input intact. (Hence a cat) Otherwise, the program shall fall ...
11
votes
2answers
377 views

Inverse quine: print everything except your program

Write a program which will eventually, given enough time, print all possible permutations of ASCII characters (both printable and non-printable) less than or equal to its length, except itself. The ...
22
votes
20answers
2k views

Case invert your quine

Write a quine which attempts to invert the case of as many ascii characters in the source code as possible. For example in javascript: ...
36
votes
28answers
4k views

Cat, Quine, Hello World

Write a cat program, a quine, and a Hello World in the same language such that when two specific programs of the three are concatenated in a certain order, you get the third program. It does not ...
-1
votes
1answer
214 views

Format yourself for codegolf! [duplicate]

Task Your task is to write a program that, taking no input, outputs a string that represents a formatted codegolf answer of itself. The pattern is the following: ...
18
votes
24answers
2k views

Counting characters

Write a function or program that accepts one character (or a string of length 1) as input, and outputs the number of times that character occurs inside the code. This program must be a Proper Quine, ...
24
votes
1answer
951 views

Program that compiles into itself

We've had lots of questions about quines, programs where the source code and output are identical. For compiled languages, there are other combinations: we've already had a question about writing a ...
22
votes
11answers
2k views

Narcissistic Quine [duplicate]

Write a program/method that: Becomes a quine when the input matches the source code; Doesn't halt otherwise. This is code-golf, so shortest solution wins. Avoid any standard loopholes.
2
votes
0answers
80 views

Selfish Programs [duplicate]

The Challenge Write two programs P and Q such that: P and ...
0
votes
0answers
193 views

What is the shortest brainfuck quine? [duplicate]

(Apart from the empty program of course) The shortest I could find was this 410 byte beauty: ...
4
votes
2answers
188 views

Inter-language 2-cycle quine [duplicate]

Challenge Create 2 programs A and B The output of program A is exactly program B The output of program B is exactly program A Neither program should depend on inputs to yield the correct output A ...
33
votes
13answers
6k views

Write a program that sees the New Year in itself

Write the smallest program that maps strings injectively to outputs and maps itself to 2020. To be clear, your program \$p\$ must have the following properties: every possible input string \$s\$ has ...
0
votes
1answer
213 views

Polyglot Iterative Quine

Introduction A polyglot is a program that is valid in multiple languages at once. An iterative quine is a program that outputs another program that outputs another program that outputs the source of ...
12
votes
4answers
398 views

Rock Paper Scissors (Sorta) Quine

Create three programs, which we'll call Rock, Paper, and Scissors. Each program must be unique, and accept input. If a program gets any input which is not one of the programs Rock, Paper or ...
1
vote
20answers
531 views

Quine in Bytes, not Characters [duplicate]

Introduction A quine is a program that takes no input and produces a copy of its own source code as output. Writing a quine is a standard test of a programming language. Most quines operate using ...
1
vote
0answers
134 views

“Know Thyself” Program [duplicate]

Challenge Write a program that takes as input a text and output "That's me!" if the input is equal to the program own source code, and "That's not me!" otherwise. Notes This is codegolf, in each ...
19
votes
7answers
3k views

Y2K… in 2019?

It's August 10th, 2019, but your task still involves Y2K. Weird, right? Create a program that prints itself, with a two digit number appended to it. The first time you run it, it should append 00 to ...
-3
votes
1answer
311 views

longest ungolfable quine [closed]

Create a quine that cannot be golfed. Your score is your byte count, where higher is better. If someone finds a shorter version, their score is your original byte count, and you lose points Scoring ...
63
votes
112answers
11k views

Print the last, middle and first character of your code

The challenge is simple: Print the last, middle, and first character of your program's source code, in that order. The middle character is defined as follows, assuming a source length of ...
13
votes
9answers
2k views

n-level Ouroboros Quine

This 128-language quine ouroboros (a program which outputs a program in another language, which outputs a program in yet another language, (125 languages later), which outputs the original program) is ...
31
votes
17answers
3k views

A quine of sorts

Given a string x, output the characters in x sorted according to the order of appearance in your source code. Examples ...
7
votes
6answers
292 views

Inverse-quotes-quine, inverted (pt. 2)

Based on a comment by Jo King on my previous question (called 'Inverse-quotes-quine'), I present this new question. The rules are similar, but just, the opposite: If your program is run normally, all ...
31
votes
18answers
2k views

Inverse-quotes-quine

The prospect of this challenge is: If your program is run normally, all of the code in the speech marks (" - double quotes) should be printed. If your program is ...
5
votes
16answers
731 views

The anti-narcissist

The narcissist is a program which, given its own source as input, prints a truthy value and, given anything other than that, prints a falsey value. Today, we're reversing this. Create a program that, ...
3
votes
2answers
732 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 \$n\$th submission must output its own source code in the \$n\$th language and the \$n−1\$ languages before it. A ...
-2
votes
5answers
318 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
302 views

Invert your code

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
536 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: ...
24
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 ...
18
votes
9answers
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 ...
8
votes
0answers
357 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
242 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 ...
11
votes
13answers
2k 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
2answers
628 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
299 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
228 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\$ ...
4
votes
2answers
248 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 ...
5
votes
15answers
679 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 ...
17
votes
10answers
1k 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, ...
15
votes
1answer
687 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
111 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 ...
32
votes
17answers
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
358 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 ...

1
2 3 4 5 6