Questions tagged [self-referential]
Used for challenges where answers make reference to themselves or their characteristics, such as length or character values. Since this is a subset of the [quine] tag, many of the same restrictions apply by default, such as not reading your own source code.
43 questions
- Bountied 0
- Unanswered
- Frequent
- Score
- Trending
- Week
- Month
- Unanswered (my tags)
23
votes
15
answers
3k
views
Write two very different programs with the same characters
Your task is to write two programs/functions, in the same language.
Program 1: Verify that two inputs are anagrams of each other.
Program 2: Verify that two inputs differ from each other at every ...
28
votes
42
answers
4k
views
Does your source code contain this character?
Given a character as input, determine if your source code contains that character or not.
Shortest code wins. Though, I'd like to see some "normal" languages too.
UPDATE: the question ...
7
votes
1
answer
350
views
Brainfuck braggy busy beaver
Challenge
Write a brainfuck program that takes as many steps to halt. Non-halting program brainfuck programs are not allowed.
Not only does it have to be busy but it should also brag by printing the ...
8
votes
1
answer
393
views
Sequence of programs that prints the next one with length growth being equal to π
Challenge
You must produce an infinite sequence of programs \$P_0, P_1, P_2,\$ ... such that each program \$P_n\,ドル when run, prints the exact source code of \$P_{n+1}\$ and then halts.
Each program \$...
9
votes
10
answers
2k
views
Figure out which of your friends reveals confidential information to the media!
Exposition
You send secret information to 100 of your friends, and the next day you discover that the information has been published! Who could have revealed it?
To determine that, you number your ...
14
votes
8
answers
834
views
Compress and decompress
Your task is to make a bidirectional compressor. It takes a list of bytes as input and returns a list of bytes as output. It has the property than whenever it is iterated twice it returns the original ...
10
votes
8
answers
941
views
Encode a Lenguage
The Len(language,encoding) family of languages is a variety of Lenguage derivatives. To encode a program into a Len language, you replace every character with its representation in a certain encoding, ...
12
votes
8
answers
1k
views
What is the link to your answer?
Goal
Your task is to create a program taking no input that returns the link to your answer. You can find a link to your answer by clicking at the share button on your answer.
Rules
Standard loopholes ...
1
vote
0
answers
184
views
Is this an anagram of its own source code? [duplicate]
I like anagrams. I like programs that reference their own source code. So this challenge combines them!
Input.
The input to the program could be anything, including letters, numbers, symbols, you name ...
33
votes
18
answers
2k
views
Substandard deviation
The mean of a population \$(x_1,\dots,x_n)\$ is defined as \$\bar x=\frac1n\sum_{i=1}^n x_i\$. The (uncorrected) standard deviation of the population is defined as \$\sqrt{\frac1n\sum (x_i-\bar x)^2}\$...
35
votes
30
answers
5k
views
Source Code Byte Frequency
Source Code Byte Frequency
Write a program that get a single byte character as an input and prints the frequency of that byte in the program's source code as an output.
Examples:
Assuming my program ...
28
votes
77
answers
8k
views
Average of your code
Inspired by this
Task
Your task is to output the average character of your code.
What is an average character?
Say we have a string golf().
We then take the ASCII ...
16
votes
12
answers
2k
views
Quines that print what their index is
We all know what a quine is. A quine is a program which prints its own source code. And we also know about the printable ASCII characters. Well... this challenge mixes both.
Your mission, should you ...
20
votes
27
answers
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, ...
32
votes
66
answers
4k
views
Triangular code, triangular output
For this challenge, submissions should be a program or function shaped like a right triangle, which produces a right triangle of the same size.
What is a right triangle?
For this challenge, a right ...