Questions tagged [source-layout]
For challenges that involve the physical layout or physical manipulation of source-code.
191 questions
32
votes
30
answers
2k
views
Join N copies of a snippet to produce N^2 characters
Challenge
Write the shortest snippet of code possible such that, when N copies of it are concatenated together, the number of characters output is N2. N will be a positive integer.
For example if the ...
21
votes
3
answers
2k
views
Anagramming Stack Exchange question titles into programs
Stack Exchange currently has 134 question and answer sites. This includes all beta sites (such as PPCG) but not Area 51 proposals nor any meta sites, except for the "mother meta".
To answer ...
4
votes
0
answers
101
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 ...
18
votes
36
answers
5k
views
The Jigsaw Code Puzzle
This is an answer-dependent challenge! The order of answers matters, and your exact task depends on the last answer that was posted. You might want to sort the answers by oldest.
Let's piece together ...
11
votes
5
answers
708
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.
...
13
votes
7
answers
1k
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 ...
1
vote
4
answers
582
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 ...
7
votes
3
answers
623
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 ...
13
votes
1
answer
874
views
Code a Code Slidey Puzzle!
The most recognizable sliding puzzle is the fifteen puzzle. It has a 4 by 4 grid, 15 tiles, and one empty grid space. The tiles can only move into the empty space and must always be in line with the ...
13
votes
1
answer
352
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, in ...
22
votes
9
answers
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 ...
55
votes
24
answers
7k
views
Significant Whitespace
We define whitespace to be any of the three characters, tab (0x09), newline (0x0A) or space (0x20).
For this challenge, you're to write two programs or functions in the same programming language, ...
27
votes
7
answers
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
...
105
votes
30
answers
16k
views
Print a Negative of your Code
Consider a square of printable ASCII characters (code points 0x20 to 0x7E) for side length N, like the following (here, N = 6):
...
20
votes
4
answers
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 ...
25
votes
7
answers
3k
views
Onion Programming
Using only printable ASCII (hex codes 20 to 7E), write a square N×N core program without comments that is surrounded by 4 more layers, creating a (N+8)×(N+8) square program (N > 0). For N = 3 the ...
19
votes
3
answers
2k
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 ...
11
votes
5
answers
770
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.
23
votes
7
answers
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)
...
34
votes
18
answers
5k
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.
...
24
votes
5
answers
2k
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
4
answers
948
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
3
answers
305
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
5
answers
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 ...
23
votes
7
answers
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 ...
48
votes
3
answers
5k
views
Code that runs the Game of Life on itself
Write two rectangular blocks of code, each w characters wide and h characters tall, that implement Conway's Game of Life when arranged in a grid. (w and h may be any positive integers)
For example, ...
29
votes
33
answers
5k
views
Program your favorite phrase
Pick a quote or phrase that is exactly 5 words long, such as Programming puzzles and code golf!.
Write a program that, when appended to itself n times, outputs the ...
47
votes
14
answers
7k
views
Make a code square with your favorite word [closed]
Pick your favorite 6 letter common English word that has no repeated letters, such as wombat.
Write a program in an N×N grid of characters without comments such ...
68
votes
36
answers
8k
views
Write a Rectangular Program that Outputs the Number of Times it was Rotated
The title says it all. Your goal is to write a program that forms a w×h rectangle of characters that can be rotated and re-run to output the number of 90° Counter-Clockwise (CCW) rotations that have ...
5
votes
1
answer
873
views
Let us create a sonnet quine! [closed]
There are programs that will output its source code to standard output and do nothing else. They also access no external output. This type of program is known as a quine, and is a common code ...
28
votes
12
answers
3k
views
Mandoline quine
Write a quine... from which every other character can be removed it still be a valid quine. You can specify whether to start removing characters at the first or second character.
Scoring criteria (...
10
votes
5
answers
1k
views
Program that prints mirror images of it's own self
Write a program that produces mirror images of itself. An example, would be the fantastic camel code that reads it's own code and produces two smaller 2x2 versions. Given the input:
...
64
votes
44
answers
10k
views
Factorial in haiku!
Task
Create a program that calculates the factorial of a number using no built-in factorial functions. Easy? The catch is that you must write your entire program (including testing it) in haiku form.
...
19
votes
15
answers
2k
views
Write a function that tells you which TWO of its lines has been removed
In my previous code challenge, I asked you to write a function that tells you which of its lines has been removed.
The instructions were:
Write a function that contains five lines.
If you run ...
29
votes
13
answers
2k
views
Write a function that tells you which of its lines has been removed
Write a function that contains five lines.
If you run the function as-is, it should return 0.
If you remove any one of the five lines and run the function, it should tell you which of the lines has ...
20
votes
21
answers
2k
views
The reversible reverser
Your task is simple. The program reads in a line of text from the standard input, and it prints out the same text in a character-reversed form. It is not allowed to print anything else.
For example:
...
14
votes
7
answers
1k
views
Avoid duplicate entries using a sign change
This anecdote contains the following intriguing exchange:
"Fine, Fred," Avi interrupted. "Then how would you change this to
avoid duplicate entries?"
"Oh, just change that one there to a ...
87
votes
20
answers
8k
views
Fault-Tolerant Hello World
At the end of your interview, the Evil Interviewer tells you, "We make all of our applicants take a short coding test, to see if they really know what they are talking about. Don't worry; it's ...
19
votes
18
answers
3k
views
Write a program that is valid after circular character shift
Potentially very difficult, but I've seen some amazing things come out of this site.
The goal is to write a program, in any language, that does whatever you want. The catch is that the program must ...
30
votes
4
answers
2k
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 ...
128
votes
21
answers
19k
views
Write a program that always outputs "2012" - even if it's modified!
This idea is not mine, though I don't know where it originated. I once met it in a programming contest very long ago (1998, if I remember correctly). The task is to write a program in your favorite ...