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.

Filter by
Sorted by
Tagged with
8
votes
8answers
677 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, ...
13
votes
8answers
938 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 ...
0
votes
0answers
123 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 ...
31
votes
16answers
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}\$...
32
votes
28answers
4k 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 ...
25
votes
74answers
7k 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
12answers
1k 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 ...
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, ...
28
votes
61answers
3k 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 ...
32
votes
57answers
6k views

Internal Truth Machine

It's a normal truth machine but instead of taking input, it uses the first character of the program. Thus, internal. The 0 and 1 are plain characters, i.e. ASCII code 0x30 and 0x31 respectively. ...
11
votes
1answer
735 views

Make a Lost Compass

Lost is a 2-Dimensional programming language where the instruction pointer starts at a random location, moving in a random direction. A description of the language can be found at the bottom of the ...
32
votes
19answers
4k views

Pass on your radiation

The task here is pretty simple. You should write a program that takes a string as input and outputs it (that is a cat program). Additionally when the \$n\$th byte of your program is removed (without ...
25
votes
13answers
4k views

Largest smallest gap

Write a function or program which takes as input a set of distinct, non-negative integers \$\{x_1, \ldots, x_n\}\$ and outputs the smallest gap between any two values in the set, i.e. \$\min_{i\neq j}|...
44
votes
101answers
11k views

Create a program that prints the number of characters it has, in words

Create a program which prints the amount of characters its source has in English words. If your program is nine letters long it should print "nine". Capitalization is ignored: in case you're ...
15
votes
11answers
978 views

Source permutation

A permutation of a set \$S = \{s_1, s_2, \dotsc, s_n\}\$ is a bijective function \$\pi: S \to S\$. For example, if \$S = \{1,2,3,4\}\$ then the function \$\pi: x \mapsto 1 + (x + 1 \mod 4)\$ is a ...
92
votes
36answers
17k views

Eww, those bytes are gross

Write a program or function that, when given a string, filters out as many distinct bytes as it can and returns the cleaned string. However, since your program hates them, none of these bytes can be ...
16
votes
3answers
936 views

Make a longer lenguage program

Lenguage is a brainfuck dialect that is notorious for breaking source restriction challenges. That is because Lenguage cares only about the length of it's source and not the contents. First, the ...
14
votes
5answers
658 views

Self Scoring Program

We have a challenge to output your own score, but it seems like all the answers there just hardcode the output and that's boring1. So lets have a new challenge. Your program must output its own ...
250
votes
131answers
35k views

Without using numbers, get the highest salary you can. But don't exaggerate!

As I'm applying for some jobs whose job advert doesn't state the salary, I imagined a particularly evil interviewer that would give the candidate the possibility to decide their own salary ...by "...
-3
votes
3answers
366 views

Make a program that prints its own size [closed]

Challenge: Create a program that prints out the size of its own source code file. For example, a 35 bytes size of program must print out 35. Pre-calculation is not valid. What I mean by pre-...
34
votes
31answers
3k views

Autogram programs

This sentence employs two a’s, two c’s, two d’s, twenty-eight e’s, five f’s, three g’s, eight h’s, eleven i’s, three l’s, two m’s, thirteen n’s, nine o’s, two p’s, five r’s, twenty-five s’s, twenty-...
64
votes
168answers
8k views

Output your Score!

Challenge: The concept is simple enough: write a full program to output its own code golf score! Output should only be the byte count of your program and a trailing ...
19
votes
21answers
2k views

The repetitive byte counter

Your task is to write a non-empty program / function of byte count L, which, when repeated M times, checks whether a given positive integer N is equal to L × M. You should, in theory, support an ...
42
votes
44answers
3k views

A Programming Puzzle of Mode Golf

Your task is to print the text Good morning, Green orb!, with every character repeated in place as many times as the most frequent byte in your source (the mode). ...
9
votes
32answers
1k views

Output with the same number of digits of pi as the length of the code

Your challenge is to print x digits of pi where x is your code length. Examples: ...
103
votes
258answers
17k views

Output with the same length as the code

In this challenge, you should write a program or function which takes no input and prints or returns a string with the same number of bytes as the program itself. There are a few rules: You may only ...
188
votes
159answers
18k views

What is the smallest positive base 10 integer that can be printed by a program shorter (in characters) than itself?

I think the question as above is clear, but just in case: Write a full program (not just a function) which prints a positive base 10 integer, optionally followed by a single newline. Qualifying ...
95
votes
278answers
16k views

Create output twice the length of the code

The Challenge Write a complete program that writes twice as many bytes to standard output as the length of the program. Rules The program must write ASCII characters to the standard output. The ...
40
votes
26answers
3k views

Difference should make no difference

Your company lately hired a new bunch of extremely dedicated sysadmins. They feel that just watching computer screens is quite limiting (I mean, 60Hz refresh rate is just NOT enough), so they hooked ...
25
votes
44answers
13k views

Write a piece of code to output the line number of the print / output statement itself (in the form "Hello World, from line X!")

The Challenge Write a program that outputs Hello World, from line X!, where X is the line number, in the source code, of the ...
69
votes
25answers
9k views

Write a program that downloads itself

Write a program that connects to this site, downloads the very answer in which it is posted, extracts its own source code and prints it out. The output must be identical to the source code. Shortest ...
223
votes
107answers
41k views

Print every character your program doesn't have

Your task is to build a program (using only printable ASCII characters and/or tabs and newlines) that prints out exactly the characters in the printable ASCII space (...
12
votes
12answers
1k views

Output code-sized Lorem Ipsum

Output the same length of Lorem ipsum your code is! Rules: Code can't be identical to output No compression libraries Shortest program in two weeks wins No network usage, file reading and other ...
15
votes
37answers
5k views

Write a program to print the sum of the ascii codes of the program

Your task is to write a program to print the sum of the ASCII codes of the characters of the program itself. You are not allowed to open any file (Any input such as command line arguments, standard ...