Last call to make your voice heard! Our 2022 Developer Survey closes in less than a week. Take survey.

Questions tagged [source-layout]

For challenges that involve the physical layout or physical manipulation of source-code.

Filter by
Sorted by
Tagged with
26 votes
28 answers
3k views

What's the Missing Code? (Cops)

Cops' Challenge Robbers' challenge here. It has now been four days since the challenge was posted so all new answers should be marked as non-competing in the title. These answers can still be cracked ...
user avatar
  • 837
14 votes
10 answers
854 views

Find the biggest chunk

This challenge is not code golf. Please read the scoring before you attempt to submit an answer. You will be given a multi-line string as input. You should output the size of the largest contiguous ...
user avatar
  • 85k
12 votes
10 answers
808 views

From code to golf (Cops' thread)

This is a cops-and-robbers challenge, the robbers' thread is here You can change the word code into golf by changing a letter at ...
user avatar
  • 27.5k
24 votes
8 answers
2k views

Write some Genetic Quines

In this challenge, you'll create some programs which behave similarly to genes. When you run one, it will return one of its two "alleles" (a half of its source code), and concatenating any ...
user avatar
10 votes
5 answers
428 views

The Most Palindromy Code to Calculate Palindromy Numbers

The string abaaba Is a palindrome, meaning it doesn't change when it's reversed. However we can split it in half to make two palindromes ...
user avatar
  • 85k
20 votes
7 answers
3k views

Hello, Toroidal Earth!

Your task is to create a program that outputs the string: Hello, Toroidal Earth! with an optional trailing newline. Additionally if I remove the first line1 of ...
user avatar
  • 85k
24 votes
8 answers
5k views

Make a Hello World using as many bytes as possible

Write a program that outputs the exact string: jan ale o, toki! ("Hello, world" but in toki pona to prevent builtins.) with an optional trailing newline. ...
user avatar
  • 85k
32 votes
7 answers
4k views

I'm a lizard, cut here!

Write an \$n\$-bytes program \$AB\$ such that: it outputs an integer \$x,\ 0\lt x\lt n\$; both its \$x\$-byte prefix \$A\$ and \$(n-x)\$-byte suffix \$B\$, when run as programs, output \$AB\$. \$A, ...
user avatar
  • 1,973
26 votes
7 answers
2k views

Happy Birthday... caird coinheringaahing? ChartZ Belatedly?

When this question was posted, it was caird coinheringaahing's birthday! (source: 1, 2, 3, 4) (It was also World Emoji Day.) As a bit of some CGCC lore, caird's name came from a Jelly answer by Dennis ...
user avatar
  • 40.2k
10 votes
44 answers
2k views

Which character to change (Robbers)

Cops thread Robbers, your task is to crack a cops answer. Reveal the character that should be changed and what it should be changed to too. Please notify the cop if you cracked their challenge. The ...
user avatar
  • 3,605
20 votes
49 answers
3k views

Which character to change (Cops)

Robbers Thread Cops, your task is to chose a program that prints a string (you can choose). Although, if you change 1 character in your code, it should print another string. But there's a twist: You ...
user avatar
  • 3,605
39 votes
31 answers
4k views

Concatenated halting problem: no + no + ... = yes

Challenge Write \$2 \le n \le 10\$ distinct, valid non-halting full programs in your language of choice. If all of them are concatenated in order, the resulting full program should be a valid halting ...
user avatar
  • 62.1k
11 votes
4 answers
517 views

Shrinking Triangles

Write an infinite list of triangle codes, defined as code where the i-th line has i bytes for all lines, such that the i-th code generates (i-1)th code and has 1 more line than the (i-1)th code. The ...
user avatar
  • 12.7k
9 votes
17 answers
3k views

Double it? Then halve it! But multiply it? Then divide it!

Idea from the doubler challenge, this may be more difficult. The program should output a positive integer or decimal point value higher than 0. If I duplicate the source code, the output should halve ...
user avatar
  • 3,605
6 votes
1 answer
307 views

Two Diehards Make a Glider

In Conway's Game of Life, there is an infinite square grid of cells, each of which is alive or dead. The pattern changes each "generation". A dead cell with exactly 3 live neighbors (...
user avatar
  • 9,791
4 votes
6 answers
451 views

I Rot-13 the source code, you Rot-19 the output!

This is alternate of a rip-off of a rip-off of a rip-off of a rip-off of a rip-off of a rip-off. Go upvote those! Your task, if you accept it, is to write a program/function that outputs/returns its ...
user avatar
  • 1,367
20 votes
24 answers
3k views

I palindrome the source code, you palindrome the input!

This is a rip-off of a rip-off of a rip-off of a rip-off of a rip-off. Go upvote those! Your task, if you accept it, is to write a program/function that outputs/returns its input/args. The tricky ...
user avatar
  • 1,367
17 votes
18 answers
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 ...
user avatar
  • 4,920
23 votes
19 answers
2k views

What's the odd one out?

You are to write a program which outputs a single positive integer \$n\$. The integer may have leading zeros and whitespace, and/or trailing whitespace. Then, choose a positive integer \$m > 1\$. ...
user avatar
-13 votes
15 answers
283 views

Reverse source code and double the input

For today's challenge you have to take an input, and if your source code is reversed, then the input should be printed doubled. Let's say your source code is ABC ...
user avatar
-13 votes
18 answers
338 views

Reverse and error!

You have to write a program, if its source code is reversed, then it will error. For example, if your source is ABC, then reversing it and writing ...
user avatar
34 votes
30 answers
3k views

Count how many times your program repeats

Your task is to write a program or function. Its output/return value must follow these rules: The program outputs 1 The program repeated ...
user avatar
4 votes
0 answers
190 views

5 tasks in (modified) BrainF**k from the Estonian OI [closed]

Introduction This challenge appeared in the 2020 Estonian Open Informatics Olympiad and was created Sandra Schumann. I thought it was interesting because it involves symmetry and is quite hard even to ...
user avatar
  • 41
30 votes
38 answers
4k views

I uppercase the source code, you reverse the input!

It's one of these again :D Your task, if you wish to accept it, is to write a program/function (without any uppercase letters) that outputs/returns its string input/argument. The tricky part is that ...
user avatar
27 votes
17 answers
2k views

Quineoid Triple - A(B) = C

Write three different programs such that when any one program is provided as input to one of the other two, you get the source of the remaining program as output. More explicitly, given programs \$A\$,...
user avatar
  • 9,791
39 votes
29 answers
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 ...
user avatar
  • 9,791
13 votes
3 answers
594 views

Writing erasable code

My phone number (which I will not be sharing here) has a neat property where there is a two digit number, which when iteratively removed from my phone number will eventually remove all the digits. ...
user avatar
  • 85k
30 votes
4 answers
3k views

Orientation Oriented Programming

Write a program for a specific language that in different orientations performs different tasks. Your code should have at least two non-empty lines and at least two non-empty columns and should ...
user avatar
  • 22.1k
5 votes
3 answers
489 views

Magic Square, Magic Code

A magic square is an \$ n \times n \$ square grid, such that the sum of the integers on each row and column are equal. Note that the definition which will be used in this challenge is different than ...
user avatar
26 votes
10 answers
3k views

Your code has an uncanny mirror twin…

Write two programs, each taking a string s and a number n ≥ 0, such that: The first program prints ...
user avatar
  • 7,781
3 votes
5 answers
537 views

Determine the lexicographical permutation your code is in

Write a program that outputs the number 0. That's a bit trivial, isn't it? Let's sort all distinct permutations of your code in lexicographical order. When any of these codes are run, it should ...
user avatar
8 votes
4 answers
508 views

Determine the cyclical shift your program is in

Write a program that outputs the number 0. That's a bit trivial, isn't it? Let the length of your program be \$S\$. Write a program that outputs the number 0. When your program is cyclically shifted ...
user avatar
34 votes
4 answers
3k views

Make The Finest Magic Code Square

In math a magic square is an N×N grid of numbers from 1 to N2 such that every row, column, and diagonal sums to the same total. For example here's a 3×3 magic square: In this challenge we'...
user avatar
32 votes
57 answers
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. ...
user avatar
  • 2,575
32 votes
21 answers
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 ...
user avatar
  • 85k
25 votes
24 answers
6k views

I shift the source code, you shift the input!

Sandbox A spin-off of a rip-off of a rip-off of a rip-off of a rip-off. Go upvote those! Your task, if you accept it, is to write a program/function that outputs/returns its input/argument. The ...
user avatar
  • 21k
11 votes
7 answers
476 views

A Change in Perspective

In this challenge you will write a piece of text which when viewed from two different angles will create two different programs. Your string as viewed from above must take a string containing only ...
user avatar
  • 85k
37 votes
24 answers
6k views

I transpose the source code, you transpose the input!

Rip-off of a rip-off of a rip-off of a rip-off. Go upvote those! Your task, if you wish to accept it, is to write a program/function that outputs/returns its input/argument¹. The tricky part is that ...
user avatar
  • 27.1k
27 votes
39 answers
6k views

I reverse the source code, you reverse the input!

Yet another blatant rip-off of a rip-off of a rip-off. Go upvote those! Your task, if you wish to accept it, is to write a program/function that outputs/returns its string input/argument. The tricky ...
user avatar
  • 5,887
41 votes
61 answers
8k views

I reverse the source code, you negate the input!

Blatant rip-off of a rip-off. Go upvote those! Your task, if you wish to accept it, is to write a program/function that outputs/returns its integer input/argument. The tricky part is that if I ...
user avatar
  • 27.1k
52 votes
67 answers
11k views

I reverse the source code, you negate the output!

Your task, if you wish to accept it, is to write a program that outputs a non-zero number(can be integer or float). The tricky part is that if I reverse your source code, the output must be the ...
user avatar
  • 3,704
33 votes
29 answers
5k views

Double it your way

There have been a couple of challenges involving doubling source code: here and here. The task we have here is a bit harder, but should be doable in almost every language. In this challenge, you will ...
user avatar
20 votes
15 answers
4k views

I multiply the source, you (probably) multiply the output!

Task The task is to write a program that outputs a consistent but otherwise arbitrary positive integer \$x\$ (so strictly greater than 0). Here's the catch: when the source is repeated \$N\$ times (...
user avatar
  • 41.4k
13 votes
5 answers
486 views

Reverse your code, reverse the OEIS

The task here is to write a program that takes an natural number, \$n\$, and produces the \$n\$th term of an OEIS sequence. That sequence should have an identifier in the form of ...
user avatar
  • 85k
14 votes
2 answers
731 views

Error-detecting Self-repairing Program

Your task is to create a program where if any one character is deleted, it will detect which character was deleted and then re-insert the deleted character in its own source file. For instance, if ...
user avatar
  • 9,791
40 votes
12 answers
2k views

A well linked challenge

An activity I sometimes do when I'm bored is to write a couple of characters in matching pairs. I then draw lines (over the tops never below) to connect these characters. For example I might write \$...
user avatar
  • 85k
8 votes
13 answers
596 views

Just Twice Is Nice

Let's have string multiplication to take a string and a positive number and concatenate that string that many times. In Haskell: ...
user avatar
  • 85k
12 votes
21 answers
3k views

Longest Increasing Substring

Given a list of positive integers, write code that finds the length of longest contiguous sub-list that is increasing (not strictly). That is the longest sublist such that each element is greater ...
user avatar
  • 85k
13 votes
8 answers
1k views

Backhanded Compliments

This challenge is created in celebration of my first esoteric language, Backhand! Backhand is a one dimensional language with a non-linear pointer flow. The pointer moves three steps at a time, only ...
user avatar
  • 44.6k
11 votes
9 answers
1k views

Everyone Ought to Have a Friend

An isolated character is a character (other than a newline) that doesn't have an adjacent character of the same type. Adjacent characters can be to the left, the right above or below, but not ...
user avatar
  • 85k