Questions tagged [source-layout]

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

Filter by
Sorted by
Tagged with
150
votes
4answers
13k views

Hyperprogramming: N+N, N×N, N^N all in one

Write a program that takes in a number N from 1 to 9 inclusive. In its native form your program should output N+N. E.g. output 2 if N is ...
1
vote
1answer
312 views

“HHeelllloo,, EEaarrtthh!!” [duplicate]

Much like this challenge, write a program or function that takes no input and prints or returns the string Hello, Earth! with an optional trailing newline. The ...
11
votes
2answers
412 views

Right and tfeL truncatable primes

A right-truncatable prime is a prime where every prefix is a prime (in base 10). A left-truncatable prime is exactly the opposite, where every postfix is a prime (primes that start with 0 aren't ...
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!" ...
16
votes
3answers
2k views

Write a program that always prints N when it is shifted N times up the ASCII alphabet

Write a program using only printable ASCII characters that takes no input. For reference, here are the 95 printable ASCII characters in order: ...
7
votes
3answers
158 views

The confused twister

The basic idea is to write a program that twists itself, and the twisted version untwists itself. The first program will just be the twisting algorithm described here, and when given its own source ...
17
votes
7answers
918 views

Normal and visual string reversion

Write some code that acts as a cat program. That is, to input a string and output it as is. But the normal reversion of your code must output the normal reversion of the input string. And the visual ...
26
votes
3answers
1k views

Create a rotating quine

A rotation of a string is made by splitting a string into two pieces and reversing their order, for example "world! Hello," is a rotation of ...
21
votes
2answers
464 views

Compile Regexes (By Substitution)

Your task is to compile regexes... by specifying a substitution for each character in a regex. Regexes The regexes support these ...
29
votes
7answers
2k views

Source Code Metamorphosis

mbomb007 asked us to make a self mutilating program. Its an interesting challenge, but I personally don't like to encourage my programs to be self-mutilating. I like to think that, at the heart of ...
18
votes
4answers
1k views

Print a Symbolic Negative of your Code

(This is a variation on Print a Negative of your Code, which I enjoyed a lot! Thanks to Martin Büttner♦ - almost all of this text is his.) Let's consider the symbols to be the following printable ...
22
votes
6answers
2k views

Mutual Negative Quines

This was inspired by Print a Negative of your Code and Golf a mutual quine. Consider a rectangle of characters, that meet the following restrictions: Consists solely of printable ASCII characters ...
34
votes
18answers
4k views

Jumblers vs Rebuilders: Coding with Tetris Bricks

In traditional Tetris, there are 7 distinct tetromino bricks, each denoted by a letter similar to its shape. ...
22
votes
7answers
3k views

Code Crosswords

This is a cops-and-robbers challenge. Answer here if you are a cop (crossword maker), answer the companion question if you are a robber (crossword solver). You may take on both roles. Cops (Puzzlers) ...
11
votes
5answers
611 views

Code Crosswords - Solutions

This is the companion question for Code Crosswords. Robber answers go here. See Where should we put robbers? for meta-info.
40
votes
8answers
6k views

40 Numbers in 9 Bytes

There are 40 ways a directed Hamiltonian path can be arranged on a 3×3 grid: This graphic (thanks Sp3000!) shows only the 20 undirected paths. Traverse each colored line in both directions for ...
16
votes
6answers
441 views

Princely Prefix by a Program in Pattern

You should write a program or function which outputs or returns as much of Chapter I of The Little Prince as it can. Your program or function has to be an M-by-N block of code containing only ...
31
votes
6answers
3k views

Write A Program That Outputs Its Mirror Level

There are 95 printable ASCII characters: !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ In the ...
22
votes
9answers
2k views

Caesar-Cypher-Mania

The Caesar Cypher is a very simple substitution cypher where each letter is shifted by a fixed offset (looping around Z to A). Similarly, we can also a Caesar cypher for the set of printable ASCII ...
21
votes
4answers
2k views
47
votes
16answers
5k views

Sierpinskified Code

Write a rectangular block of text that when arranged into a Sierpinski carpet, using same-sized blocks of spaces for the empty portions, creates a program that outputs the iteration number of the ...
21
votes
12answers
2k views

Reading Code in 8 Ways to Output 8 Numbers

The English language and most programming languages are written and read from left-to-right, top-to-bottom, but that needn't be the case. In fact for the block of text ...
10
votes
4answers
740 views

Put the line in the code you nut and shake it all up

Using one programming language write 5 single-line programs, each of which outputs a different line of the first verse to Harry Nilsson's 1972 song "Coconut" when run individually: Brother bought a ...
10
votes
4answers
520 views

Write a binary counter in quine

Write two code fragments, which we will call s_zero and s_one. Program (l, n) consists of l copies of s_zero and s_one corresponding with the digits of n in binary, padded with s_zero on the left. ...
4
votes
0answers
92 views

Resistent counter [duplicate]

You just have to ouput exactly all the numbers from 1 to 10 separated by spaces. Your programme should work all the times even if a random character is deleted before compiling/interpreting. This is ...
1
vote
4answers
456 views

All those duplicate questions deserve duplicate code to show them off

All those questions that are duplicates... Ignored and marginalized by society. It is just not... right. We have to do something. There surely must be love for them too. They feel appreciated if a ...
6
votes
3answers
500 views

Retrograde morse (d)e(n)coder

This question is inspired by retrograde music. Retrograde music is a piece of music that can both be played normally (from the beginning to the end) as reversed (from the end the beginning). A similar ...
12
votes
1answer
261 views

Golf some quine stripes in different languages

You will choose m languages and write n programs in each language, each with length n*m. The kth program should output the kth character of each program, ordered by the program number. For example, ...
17
votes
3answers
1k views

Choose-Your-Own-Language Code

Let's take a grid of 16x16 printable ASCII characters (code points 0x20 to 0x7E). There are 30-choose-15 paths from the top left to the bottom right corner, making only orthogonal moves, like the ...
20
votes
4answers
2k views

The Fatal Error Challenge

Objective Write a routine that accepts a string of printable ASCII characters, s, and returns a string containing the same characters as s, reordered so that no two-character substring appears more ...
22
votes
3answers
1k views

Write a square program that outputs the number of times it has been “unrolled”

Consider a square block of text, N characters wide by N tall, for some odd integer N greater than 1. As an example let N = 5 and the text be: ...
10
votes
4answers
855 views

Anagramming Code

Let's try this again. The object of this contest is to make two pieces of code that are anagrams of each other (the two must contain the same bytes in a different order), and they will do the ...
2
votes
3answers
258 views

Writing Phrases with Code [closed]

This is my first contest, so please tell me what I can do to improve. The object of this contest is to write program lines in your language of choice that are both valid code and self-descriptive in ...
27
votes
5answers
2k views

Radioactive Quines

A radioactive quine is a quine-like program that has an even number of characters and, when run, outputs itself with exactly half of its characters removed. The output itself may be a radioactive ...
19
votes
6answers
2k views

Run the Nth characters to get N

Write the shortest program possible such that when you combine the first character and every Nth character after it into a new program, the output is N. This must work for N = 1, 2, ..., 16. Another ...