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
43
votes
24answers
2k views

Output the first position in your program for each input character

Challenge Write a non-empty program/function p that, given a non-empty input string s, outputs the position of the first ...
23
votes
9answers
691 views

Incremental Quine

​Your task is to write a program or function that outputs the first character of its source code, then the second, then the third... each time it is run. For example, if your program was ...
5
votes
4answers
611 views

The Essential™ (comment-free) Convenient Palindromic Quine Golf

A program is "conveniently palindromic" if it is equal to the string derived when its reverse has all its parentheses (()), brackets (...
19
votes
11answers
3k views

Cheating Cyclic Quine

Concept Write a program that outputs code in its programming language. That code, when executed, must output the original program. Rules Since this is a cheating quine, you can read the original ...
22
votes
7answers
721 views

Print Polyglot Pieces

Typically, polyglots are constructed in such a manner that each language can ignore parts of the code that are present for other languages, by wrapping them in string literals, using comment syntax, ...
15
votes
2answers
828 views

Match the permutations!

Your challenge is to create a regex that matches every string permutation of itself, and nothing else. The match must also be case-sensitive. So, for example, if your regex is: ...
8
votes
2answers
470 views

The logical quine

The challenge Simply write a program that outputs its own source code. Nothing more than a regular quine. The problem We don't have a computer so we have to run the program on a programmable logic ...
32
votes
7answers
1k views

Three polyglots, two period-two quines, and one code-golf challenge

Produce a program A such that running it in language A produces Program B, and running program A in language B produces program C. Program B, when run in language B produces Program A, and running ...
8
votes
14answers
766 views

Quine Anagrams! (Robbers' Thread)

This is the robbers' thread. For the cops' thread, click here. Cops' Task For the cops' thread, click here. Robbers' Task Find an uncracked submission on the cops' thread. (A submission may only ...
22
votes
25answers
2k views

Quine Anagrams! (Cops' Thread)

This is the cops' thread. For the robbers' thread, click here. Cops' Task First, write a quine in a language of your choosing. Next, scramble the quine. Make sure to do this well as the robbers will ...
7
votes
3answers
286 views

Write a continuous quine (quine-variant)

Let's define a 2-quine as a program that prints its source code two times. For example, if the program ABC printed ABCABC, it ...
18
votes
9answers
773 views

The meta-polyglot quine

In my time on PPCG, I've noticed that quine problems and polyglot problems are quite popular. Also, meta-solutions to problems, that is, scripts which generate a program which is the solution to a ...
19
votes
7answers
651 views

Generate a Markdown Template for your Post

Your task is simple: Write a program (or function) that takes no input and outputs something like this: ## *name*, *length* bytes *code* Where ...
17
votes
9answers
906 views

Markov Chain Quine

A simple Markov Model will be used in this question. For more information about Markov Chains, see http://setosa.io/ev/markov-chains/. Take a string. For this example, we will use the word: ...
1
vote
1answer
423 views

Write a self-aware program [duplicate]

A standard (but disputed) test of self-awareness is the mirror test: An animal is considered self aware if it can recognize itself in the mirror. Your task is to write a program that is self-aware ...
27
votes
2answers
753 views

Hyper about quines

Inspired by Hyperprogramming: N+N, N×N, N^N all in one. Thanks to @MartinEnder and @trichoplax for their help in the sandbox. Definitions Hyperquines Define a hyperquine of order n as a quine-...
25
votes
2answers
2k views

Write a Palindrome-Polyglot-Quine

Write a "palipolyquine": a program that is a quine, a polyglot, and a palindrome. Rules: The number of polyglot languages is more preferable than code size. The shortest answer (in bytes) wins, in ...
18
votes
11answers
3k views

Source code GO!

Let's use augmented reality to hunt small creatures hidden in source-code. Write a quine program that outputs its own code source, except for 5 consecutive characters that will be modified and that ...
23
votes
19answers
3k views

Faux Source Code

Output one random character for each character of source code (as illustrated below). The probability of each character is its frequency in the original source code. Thus the output will be fake ...
30
votes
8answers
2k views

A Fragile Quine

A Fragile Quine A fragile quine is a quine that satisfies the property of having each substring made by removing a single character, when evaluated, produces an error. For example. If your program <...
9
votes
6answers
757 views

The longest period iterating quine

As we know, a quine is a program that outputs its own source code. However, it's also possible to write a program that outputs another, different program, that outputs the first program again. For ...
3
votes
1answer
172 views

Check if input is permutation of source [duplicate]

Inspired by Input ∩ Source Code. Task Your task is to determine whether the input is a permutation of the source code. Input A string. Input is flexible; it should be able to handle the character ...
70
votes
43answers
6k views

Input ∩ Source Code

Intro The challenge is to create a program/function that prints the intersection of its own source code and a given string input. This is code golf and to be more precise: Let ...
-3
votes
3answers
582 views

No Quine Built In? No Problem! [closed]

Are you tired of languages with built in quining techniques? Your challenge, should you choose to accept it, is to add a built-in quine feature to the language of your choice. Task Given some ...
5
votes
10answers
1k views

I hate Mondays!

You should a program in language X, which will only output its source code (i.e function as a quine) when it is not a monday. On monday it should output some string with a levehnstein distance of 4 ...
0
votes
1answer
197 views

Tell Me about yourself [closed]

Your task is to write a self referential program similar to a quine. The objective is to write a program that will generally print to stdout twice whatever the input is. But when it receives the input ...
40
votes
14answers
2k views

Stack Exchange Vote Counter

Write a program/function that returns the vote count of its own Stack Exchange answer at the time of its execution. Your program/function may access this page (codegolf.stackexchange.com/questions/...
17
votes
10answers
1k views

Compress your code in an image

This is a quine variation. Introduction We all write short code, because some obscure reasons, but whatever we do, the'll take up at least 144 pixels/byte (with a 12px font). But what would happen, ...
1
vote
1answer
211 views

Continuously expanding code [duplicate]

Your job is to write a program that rewrites and makes itself longer on each run of the program. Challenge The program will print Hello, World!\n (...
6
votes
1answer
446 views

QWERTY Quine Creation

Challenge Create a quine, that instead of outputting it's source, output's it's source QWERTY-sorted. What is QWERTY sorting? QWERTY sorting is sorting code by the QWERTY keyboard. Anything higher ...
1
vote
1answer
229 views

Write a narcissist program! [duplicate]

A narcissist program is simple. It is related to a quine. If the input is equal to it's source code, it prints a truthy value, if not it prints a falsy one. That is it. Rules: It can't read it's ...
13
votes
11answers
2k views

Double-duty quine: quine!dlroW ,olleH

Write a program that will output its own source code when run, and nothing else. Seems easy, right? The catch is that when the source code is reversed, your program must output "Hello, World!" ...
38
votes
2answers
1k views

Radiation softened quine

It's simple: Make a proper quine where if you remove any character, it's still a quine. The difference between this and a radiation hardened quine is that if your program is ...
4
votes
2answers
222 views

ROT-128 oscillating quine (Mutual Quine)

ROT-128 is a variant of ROT-13, where instead of cycling through the 26 letters, you cycle through the 256 possible bytes. Your task is to create a program that outputs the ROT-128 of its own source. ...
10
votes
6answers
354 views

Transpose quine

In this quine variant, your program must output its source code transposed across the diagonal from the top left to the bottom right. For example: your program on four lines outputs ...
34
votes
13answers
3k views

1-up your average quine

A 1-up quine is a program which is very similar to a quine. The one major difference is that instead of printing itself once, when n copies of the program are concatenated, the result prints the ...
19
votes
20answers
2k views

Write a Metaquine

A metaquine is a program which is not a quine, but whose output, when run as a program in the same language, is a quine. The goal of this challenge is to write a metaquine. This is code-golf, so ...
10
votes
4answers
464 views

Write a Semiquine

Suppose you have 2 languages, A and B. A string s is a semiquine in ...
14
votes
9answers
1k views

Indexable quine

The goal of this challenge is to make a program that outputs the nth letter of its source code where n is given as input to the program. Like most quine challenges, you are not allowed to read your ...
6
votes
4answers
242 views

Write a program to output the nth fibonacci number in quinary

Quinary is like binary, except that 1 is represented by the text of the program, and 0 is represented as the backwards text of the program. The Fibonacci Sequence is the well known sequence F(0) = 0,...
21
votes
7answers
921 views

Generate Programs in Increasing size

In this challenge, you will write a program which outputs a program which is the double the length of the original program. The outputted program should output a new program a program double its ...
13
votes
9answers
1k views

Quinean Regex Tester

This challenge is pretty simple. As input, you take in a regular expression. Then, you output a truthy/falsey of whether or not your source code matches the regular expression. It's that simple! Just ...
18
votes
4answers
794 views

Growing Quine Sequence

You are to write a sequence of 10 programs p1 p2 ... p10 that satisfy the following properties: pK prints ...
26
votes
2answers
602 views

Lipogram “quine”

Task Take a single Unicode character as input. Output a program in the same language that also obeys this specification, but which does not contain the input character. If your program is run with ...
22
votes
10answers
1k views

Quat. Quine + Cat

A Quat is a combination of a quine and the popular esolang cat program. Challenge The challenge is to write a standard cat program. Whatever the user inputs, the program will echo the input to ...
2
votes
0answers
586 views

Make a program that outputs its own MD5 hash [duplicate]

Challenge: make a program that outputs a MD5 hash of its source code. You should not use tricks that would be considered cheating in a quine sense (discussed here). Using built-in functions and ...
2
votes
1answer
231 views

Quine Pride Parade!

These days, I watched on TV a Gay Pride parade; at the time, I was thinking about quines and how they're a bit queer, outputting themselves (out of the closet?) and, well, why not combine both things ...
23
votes
1answer
503 views

Three mutual quines

The task In this challenge, your task is to write three programs that form a kind of mutual quine-like system. Let's call the programs A, ...
22
votes
4answers
505 views

Multiple program Quinecatenate!

Your task is to give three different languages A, B, C, and write two different programs P and Q such that: P is a quine in language A, but not a quine in B nor C; Q is a quine in language B, but ...
12
votes
7answers
644 views

Signal-Interrupting Quines

Quining has a long history - if you haven't heard of it, click the tag and read up a little on it. Your Task Output an infinite series of 1s (with no other ...