Skip to main content

Questions tagged [source-layout]

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

Filter by
Sorted by
Tagged with
58 votes
72 answers
12k views

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 ...
TwilightSparkle's user avatar
33 votes
29 answers
5k views

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 ...
GammaFunction's user avatar
20 votes
15 answers
4k views

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 (...
Mr. Xcoder's user avatar
  • 42.9k
13 votes
5 answers
557 views

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 ...
Wheat Wizard's user avatar
  • 103k
14 votes
2 answers
833 views

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 ...
Beefster's user avatar
  • 10k
41 votes
13 answers
2k views

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 \$...
Wheat Wizard's user avatar
  • 103k
9 votes
13 answers
753 views

Let's have string multiplication to take a string and a positive number and concatenate that string that many times. In Haskell: ...
Wheat Wizard's user avatar
  • 103k
13 votes
23 answers
3k views

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 ...
Wheat Wizard's user avatar
  • 103k
13 votes
8 answers
1k views

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 ...
Jo King's user avatar
  • 48.1k
12 votes
9 answers
1k views

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 ...
Wheat Wizard's user avatar
  • 103k
50 votes
24 answers
4k views

A shape is chiral if no amount of rotation can make it look like it's mirror image. In this puzzle we will be writing chiral computer programs. For this puzzle we will think of a program as a ...
Wheat Wizard's user avatar
  • 103k
31 votes
8 answers
5k views

Your task is to write a non-empty computer program comprised of some sequence of bytes. If we choose a particular byte in the program and remove all instances of it from the program, the modified ...
Wheat Wizard's user avatar
  • 103k
39 votes
14 answers
3k views

A Geiger counter is a device that is used to detect radiation. We will be making a Geiger counter program. As we all know, when radiation hits a computer program it removes exactly 1 byte at random. ...
Wheat Wizard's user avatar
  • 103k
37 votes
28 answers
5k views

Defintion A centrosymmetric matrix is a square matrix that is symmetric about its center. More rigorously, a matrix \$A\$ of size \$n \times n\$ is centrosymmetric if, for any \$i,\: j \in ([1, n] \...
Mr. Xcoder's user avatar
  • 42.9k
33 votes
17 answers
5k views

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 ...
Beefster's user avatar
  • 10k
19 votes
22 answers
3k views

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 ...
Mr. Xcoder's user avatar
  • 42.9k
27 votes
21 answers
3k views

Your task is to build a program that identifies the shape of the input. The shapes to be identified can be any of the following: Square To be identified as a square, the source must have lines of ...
Dom Hastings's user avatar
  • 24.7k
22 votes
5 answers
542 views

Four integer sequences In this challenge, you will test four different properties of a positive integer, given by the following sequences. A positive integer N is perfect (OEIS A000396), if the sum ...
Zgarb's user avatar
  • 43.2k
10 votes
6 answers
537 views

A checkerboard program is a program where each individual character's ordinal value alternates from even to odd, excluding the line terminator (which can be any standard line-endings). A triangular ...
Dom Hastings's user avatar
  • 24.7k
11 votes
11 answers
1k views

Given an array of positive integers A as the input, generate a program that, when repeated for k times, output the ...
l4m2's user avatar
  • 32.6k
41 votes
9 answers
5k views

A string can be shifted by a number n by getting the byte value c of each character in the string, calculating ...
Laikoni's user avatar
  • 26.4k
51 votes
51 answers
5k views

Your task, if you wish to accept it, is to write a program that outputs a positive integer (higher than 0). If the source code is duplicated the output must remain the same. The tricky part is that if ...
workoverflow's user avatar
  • 1,045
11 votes
2 answers
5k views

I'm attempting to create a function over multiple lines. Parameters of the challenge: Function returns 'barbarian' Only 2 characters per line 40 lines maximum. I keep trying to use a fat arrow to ...
theNewfelll's user avatar
18 votes
4 answers
977 views

A half cardinal cyclic quine is a cyclic quine with two states, one perpendicular to the other. Rules You can decide which rotation you want to implement, clockwise or counter-clockwise. Once ...
Dom Hastings's user avatar
  • 24.7k
30 votes
18 answers
5k views

or: Build a vertical quine Inspired by Take a stand against long lines. Your task is to build a vertical quine with as short a line length as possible. Scoring Shortest line length (excluding ...
Dom Hastings's user avatar
  • 24.7k
14 votes
8 answers
579 views

Your task is to write a computer program such that when it is cut up into lines (split on the newline character) every arrangement of the lines will output a different number between 1 and n! (where n ...
Wheat Wizard's user avatar
  • 103k
45 votes
20 answers
6k views

Your assignment is to write a program of even length, that prints an ASCII-art square (described below), that increases its side length by 1 unit each time the original source code is pasted in the ...
user avatar
18 votes
8 answers
2k views

A Russian nesting doll, more commonly known as a Matryoshka doll, is a doll which contains a smaller version of itself, which then contains another smaller version of itself, which contains a smaller ...
Jo King's user avatar
  • 48.1k
35 votes
21 answers
4k views

Given a string as input find the longest contiguous substring that does not have any character twice or more. If there are multiple such substrings you may output either. You may assume that the ...
Wheat Wizard's user avatar
  • 103k
30 votes
28 answers
3k views

Your challenge is to write N snippets of code such that, when you concatenate the first K ≥ 1 together, they produce the number K. The higher N, the better. Here's the catch: you may not use any ...
Conor O'Brien's user avatar
19 votes
21 answers
3k views

This is part of a cops-and-robbers challenge. Go here for the cops' part. The Robbers' Challenge A cop's answer can be cracked by removing any subset of characters from the Haystack program, so that ...
Martin Ender's user avatar
41 votes
25 answers
5k views

This is part of a cops-and-robbers challenge. Go here for the robbers' part. The Cops' Challenge You should write a program or function in a language of your choice, which outputs the string ...
Martin Ender's user avatar
-9 votes
29 answers
933 views

Objective Write a program that outputs some printable ASCII characters. The trick is that if the program is reversed byte-by-byte, it must output the same thing in the reverse order, byte-by-byte, ...
iBug's user avatar
  • 2,731
8 votes
7 answers
419 views

Related: I double the source, you double the output! When Steve Jobs launched the iPhone 3G, the slogan said Twice as fast, half the price I changed the word fast to long to better represent this ...
iBug's user avatar
  • 2,731
4 votes
34 answers
3k views

Write some code... Write a program that takes no input and outputs an integer n which is a multiple of 3. So ...
user avatar
40 votes
20 answers
4k views

Input no input for this challenge The Challenge Write a code that outputs: The first 10 prime numbers whose sum of their digits equal the number of bytes of your code Examples Let's say your code is <...
user avatar
6 votes
4 answers
723 views

Write a proper quine containing at least one newline/linefeed whose every unfurling is either itself a proper quine or outputs the original quine. Your answer can mix and match outputting itself and ...
fireflame241's user avatar
  • 16.4k
9 votes
7 answers
924 views

Note: This challenge has nothing to do with actual assembly language. As the head of Code-Golf Factory Inc., you must create an assembly line to generate a specific piece of code. Today, the foreman ...
Julian Lachniet's user avatar
9 votes
32 answers
2k views

Squares looks symmetric, and so are the required codes. Objective: Write a program whose source code is a solid square (N lines with N printable, non-whitespace characters each line) and prints a ...
iBug's user avatar
  • 2,731
27 votes
27 answers
2k views

Task You're in charge of making a compass, of sorts. Imagine your source code as the compass "needle" where running at different orientations produces distinct output. Supported source code ...
CzarMatt's user avatar
  • 1,979
40 votes
29 answers
6k views

Based on this challenge. In the rhythm game osu!, the difficulty modifier "Double-time" actually only increases the speed by 50%. Your task, is to write a program that outputs a positive ...
Mayube's user avatar
  • 11.8k
1 vote
9 answers
279 views

Given a string and integer n, split the string at n character, and print as follows: Ex) laptop 3 should print lap top ...
K Split X's user avatar
  • 1,125
22 votes
22 answers
3k views

As a kind of part 2 to Hello, World! (Every other character), write a program such that all three of these programs print "Hello, World!": the entire program, the 1st, 3rd, 5th, etc. characters of ...
pommicket's user avatar
  • 3,187
6 votes
0 answers
114 views

Heavily inspired by Hello, World! (Every other character) Write a program that outputs 1. When the first, third, fifth, etc. chars are removed, it outputs ...
Stephen's user avatar
  • 14.2k
23 votes
6 answers
874 views

For this challenge, you should write a program or function which outputs the diagonals of a given square matrix. However, if you transpose the rows and columns of your solution's source code, it ...
Martin Ender's user avatar
146 votes
92 answers
25k views

Write a program that prints "Hello, World!". But also, if you take only the first, third, fifth, etc. characters of your program, the resulting program should still print "Hello, World!". If your ...
pommicket's user avatar
  • 3,187
23 votes
28 answers
3k views

Recently, someone proposed more stringent limits for Python's default line length: Clearly, no program should ever use more than 80 characters per line, for a whole host of reasons. First and ...
Nick T's user avatar
  • 3,297
10 votes
5 answers
2k views

The Task In this challenge, your task is to write a program, which takes in no input, with as many anagrams that are quine of themselves as possible. Your score will be the number of anagrams of your ...
Arjun's user avatar
  • 5,174
69 votes
6 answers
5k views

Write a program (or function) that exhibits four common big O time complexities depending on how it is run. In any form it takes in a positive integer N which you may assume is less than 231. When the ...
Calvin's Hobbies's user avatar
88 votes
64 answers
8k views

Your task is to write a program that outputs the exact string Programming Puzzles (trailing newline optional), but when all spaces, tabs, and newlines are removed ...
user avatar