This "sandbox" is a place where Code Golf users can get feedback on prospective challenges they wish to post to main. This is useful because writing a clear and fully specified challenge on your first try can be difficult, and there is a much better chance of your challenge being well received if you post it in the sandbox first.

Sandbox FAQ


To post to the sandbox, scroll to the bottom of this page and click "Answer This Question". Click "OK" when it asks if you really want to add another answer.

Write your challenge just as you would when actually posting it, though you can optionally add a title at the top. You may also add some notes about specific things you would like to clarify before posting it. Other users will help you improve your challenge by rating and discussing it.

When you think your challenge is ready for the public, go ahead and post it, and replace the post here with a link to the challenge and delete the sandbox post.


The purpose of the sandbox is to give and receive feedback on posts. If you want to, feel free to give feedback to any posts you see here. Important things to comment about can include:

  • Parts of the challenge you found unclear
  • Comments addressing specific points mentioned in the proposal
  • Problems that could make the challenge uninteresting or unfit for the site

You don't need any qualifications to review sandbox posts. The target audience of most of these challenges is code golfers like you, so anything you find unclear will probably be unclear to others.

If you think one of your posts needs more feedback, but it's been ignored, you can ask for feedback in The Nineteenth Byte. It's not only allowed, but highly recommended!

It is recommended to leave your posts in the sandbox for at least several days, and until it receives upvotes and any feedback has been addressed.


Search the sandbox / Browse your pending proposals

The sandbox works best if you sort posts by active.

To add an inline tag to a proposal use shortcut link syntax with a prefix: [tag:king-of-the-hill]. To search for posts with a certain tag, include the name in quotes: "king-of-the-hill".

Get the Sandbox Viewer to view the sandbox more easily!


3478 Answers 3478

107 108
110 111

Return all elements around an index forming sun

Define a function that takes in a 2D array and a 2D index, and return all the elements of the 2D array that are directly vertical to, horizontal to, and diagonal to the given index, and the returned list must omit the index itself.

External modules, like numpy, as allowed. The most efficient program wins.

enter image description here

  • \$\begingroup\$ ... while we do have [fastest-code] on this site, there are specific requirements; restricting allowed programming languages is another problematic thing; \$\endgroup\$
    Feb 8 at 14:38
  • \$\begingroup\$ besides, this definitely sounds like that you're outsourcing your homework to this site. \$\endgroup\$
    Feb 8 at 14:38
  • \$\begingroup\$ @user202729 I already have a numpy solution... this is definitely not homework XD \$\endgroup\$ Feb 8 at 15:34
  • \$\begingroup\$ @user202729 Okay, removed language restriction. \$\endgroup\$ Feb 8 at 15:35
  • \$\begingroup\$ Okay, the other problem is with "most efficient code win". Code golf is popular around here because it's easy to measure, but with this you have to install all sort of weird programming languages on a test machine. \$\endgroup\$
    Feb 9 at 2:07
  • 2
    \$\begingroup\$ I don't think this is very interesting to do fastest code anyway, because it can be done in linear time anyway (with the array given); besides the general consensus is to allow "full program or function" [please review other sandbox posts] \$\endgroup\$
    Feb 9 at 2:11
  • \$\begingroup\$ @user202729 Okey. \$\endgroup\$ Feb 9 at 2:27

Create a Screw

There are a variety of code cad languages, as well as other 3d API's that allow you to define shapes with code. Some of these are limited, while others are Turing complete and/or use a popular programming language such as Python or JavaScript.

The Challenge

Output a 3d model of a screw. Acceptable formats include .stl files and .obj files. A screw is defined as a shorter, wider cylinder on top of a taller, thinner cylinder, which should be threaded at least 5 times. Winner is whoever has the shortest code by two weeks after this question is posted. Standard rules and loopholes apply, with the exception that anything that allows you to programmatically define a 3d object is treated as a program language.


Should I add a spot for the screw driver to my definition of a screw? On the one hand, that would be more realistic, but on the other, it might just add bloat to answers, since I don't think there's anything interesting you can do with it.

I plan to include an example of a minimal screw under whatever definition I end up using, with pictures and outputs in every allowed format.

For the purpose of sorting and answer headers, should each langauge/framework combo be treated as a separate language? I'm leaning towards this, since It would be cool to have an easily searchable set of code for a bunch of different frameworks.

  • 1
    \$\begingroup\$ While the challenge is probably clearly defined enough, it might not allow solutions more interesting than hardcoding compressed output. \$\endgroup\$
    Feb 15 at 2:04
  • \$\begingroup\$ How could I make sure that it does without fundamentally changing it? Or do you think that's not possible? I feel like there might be some potential for interesting ways of doing the threading, but I haven't used very many of these languages.. \$\endgroup\$
    – import huh
    Feb 15 at 2:40
  • \$\begingroup\$ No idea... I think that (1) if there's a lot of boilerplate in the file format, using a library might be shorter (2) if the structure of the output file is not very repetitive, computing the coordinates might be shorter than hard coding + compressing it. I'm not familiar with either file format so I can't tell. -- -- nevertheless the challenge is on-topic; what I've said only concerns whether it's interesting [please review other sandbox posts] \$\endgroup\$
    Feb 15 at 2:46
  • \$\begingroup\$ I think both formats basically just contain the points for every triangle used to represent the 3d object. To be honest I didn't really think about directly creating the file. Compared to using a library, it seems incredibly inefficient. That could make for an interesting challenge on it's own, though... \$\endgroup\$
    – import huh
    Feb 15 at 2:58
  • \$\begingroup\$ You should probably add a specific diagram with the proportions for the screw, or maybe ask the program to take it as input \$\endgroup\$
    – Razetime
    Feb 15 at 2:58
  • \$\begingroup\$ @Razetime There's no specific proportion, just "larger" and "smaller". \$\endgroup\$
    Feb 15 at 3:06

Print your PPCG avatar

This is a graphical output question.

You have to connect to the codegolf.stackexchange.com in your homepage, scrape and download your avatar and show it in your default image viewer or some other way.

Standard loopholes apply, connections only allowed to codegolf.stackexchange.com

One language can be only used once, but a user can post multiple answers in different language

Tags: ,,

  • 3
    \$\begingroup\$ This is probably a dupe of this. Finding the avatar instead of the id wouldn't affect most of the code. Your final line is odd, do you mean that if I answered in a language it would prevent anyone else from using that language? That seems like a bad rule - what if I started on my answer and someone posted while I was working? I can't see any benefit, but perhaps I am not understanding. \$\endgroup\$ Feb 20 at 18:10
  • \$\begingroup\$ I think it would be interesting if you have to print the ascii representation of the user before you , without scraping. With a standard way to produce the ascii image so people can't differ. i.e. img to ascii \$\endgroup\$
    – Alex bries
    Feb 20 at 21:13

See who can write the longest code in order to print "Hello World!". The rule is that if you remove any single character from the code, it should NOT run.

  • \$\begingroup\$ I think we have a similar challenge already. It's pretty easy to get an infinite score with these rules. \$\endgroup\$ Feb 25 at 1:23
  • 3
    \$\begingroup\$ It is a weaker version of Programming in a Pristine World and a different variant of Biggest Irreducible Hello World. But note that, in many languages, it is possible to add arbitrarily long no-op code that breaks when exactly one char is removed. For example, Python's ''+''+''+... causes syntax error when any of ' or + or a newline surrounding it is removed. \$\endgroup\$
    – Bubbler
    Feb 25 at 1:41

Output function from one to another

I tried to post this twice and I gained negative feedback, so I will put what I have in mind here if anyone is interested.

Get a certain output function from one programming language and transfer to another. You'll be recreating an output function that came from a different programming language. There is a certain criteria in order for the answer to be valid:

  1. It should function the same way as the original function. All things that function can do should be applied to the recreated one. For example, Python's print() has certain keywords like end.
  2. Syntax doesn't matter. Example, if you can't use the << for cout, don't use it. Use what's available.
  3. The function should be able to output the same errors like the original. Replicate the same errors from the original function. If impossible, leave it out.

An answer example would be making printf() from C using Python or making Console.WriteLine() (or just WriteLine() if incapable) from C# using Ruby. Any output functions that are already similar to 2 languages don't need to be replicated in any of them.

  • 1
    \$\begingroup\$ "Get a certain output function from one programming language and transfer to another." To clarify, is the challenge to write source code which works in two different languages and does the same thing? What's the winning condition because this sounds very trivial. For example, print does the same thing in many languages. \$\endgroup\$
    – 79037662
    Feb 24 at 20:25
  • 2
    \$\begingroup\$ Actually that doesn't mesh with "syntax doesn't matter". The point of this challenge is completely unclear, could you please clarify it? \$\endgroup\$
    – 79037662
    Feb 24 at 20:26
  • 1
    \$\begingroup\$ I see you edited this post but the point of the challenge is still completely unclear. What exactly would a valid submission look like? \$\endgroup\$
    – 79037662
    Feb 25 at 20:56
  • \$\begingroup\$ I don't really get the point of this task. Sure, someone could write code that does this, it might take some work to get exactly right, but is there a challenge underneath it? Is it code golf? \$\endgroup\$
    – xnor
    Feb 26 at 3:08
  • \$\begingroup\$ @xnor It isn't code golf, nor king of the hill. It's an ordinary coding challenge if they can replicate a function from one language to another. \$\endgroup\$ Feb 26 at 5:53
  • 1
    \$\begingroup\$ @MarkGiraffe That's not really a thing on this site -- challenges need to have an objective winning criterion. From the close reason: "Questions without an objective primary winning criterion are off-topic, as they make it impossible to indisputably decide which entry should win." \$\endgroup\$
    – xnor
    Feb 26 at 8:13

Random Roman Numerals

Printing a random number is easy, but what about roman numerals? Your task is to output a random roman numeral from 1 to 1000, both inclusive.


  • Each number has to have the same chance of appearing
  • The program should use the language's random module or other random algorithm

Remember, I is 1, II is 2, III is 3. V is 5, X is 10, L is 50, C is 100, D is 500, and M is 1000. Also note that IV is 4, IX is 9, XL is 40, XC is 90, CD is 400, and CM is 900. For more information see the Wikipedia page.

This challenge is , so try to have the shortest program possible!

  • \$\begingroup\$ I'd really recommend loosening the restrictions for the random numbers. What if the language's random module doesn't guarantee exactly equal chances? Can we assume it does? What about an implementation of an algorithm typically used by language's random modules, like xorshiro or the mersenne twister? A much better restriction in my opinion would be requiring that every result is possible, and it's unlikely people will deviate too far from a uniform distribution anyway. \$\endgroup\$ Mar 10 at 5:43
  • 1
    \$\begingroup\$ Sounds like you're combining two or more unrelated core challenges into one ― consider splitting the challenge up into separate challenges ― or dropping unnecessary parts. Just watch out for duplicate challenges: random number generation and Roman numeral conversion are popular tasks. \$\endgroup\$
    – Adám
    Mar 10 at 6:01

Is this an one-one function?

, , ,

Two sets given as input, one is the domain of a function, and other one is the co-domain of a function. As an example

$$ \{1,2,3,4\} $$ $$ \{5,6,7,8,9\} $$

Now if the range set of the function, i.e. set of each element in the co-domain set which maps to the domain set (1 -> 5, 2 -> 6, ......) is equal to the co-domain set, then it is a one-one function.

For the above example, the range set is

$$ \{5,6,7,8\} $$

So the range set is not equal to co-domain set, the function is not a one-one function.


Inputted two domain and co-domain set of function, output a truthy value if the function is one-one or falsey if not.

Test cases

{1,2,3,4} {5,6,7,8,9} -> Falsey
{a,b,c} {b,c,d} -> Truthy
{4,8,2} {3,4} -> Falsey

Standard loopholes apply, , so shortest code wins

Pre-defining the input sets in the header section of TIO is not allowed.

  • 5
    \$\begingroup\$ Is this challenge simply asking if the two sets have equal length? If not, can you include counterexamples? \$\endgroup\$ Mar 21 at 18:03
  • \$\begingroup\$ @water_ghosts yes i feel it is like that \$\endgroup\$
    – wasif
    Mar 22 at 5:14
  • 1
    \$\begingroup\$ not particularly interesting \$\endgroup\$
    – rak1507
    Mar 22 at 12:11

Remaking Kernel

I made a program as a final project in the main CS50 Harvard course, and it was named Kernel, written in C alsongside CS50's library.


It has 7 functions: 4 main (talk, count, calculate, build) and 3 advice functions (error, feedback, help).

What each function does:

  • Talk asks for a prompt to the user and outputs the same thing. Talk Function
  • Count asks for a number to count from 1 to there. If the number is bigger than 50, it will lead to an error. Count Function
  • Calculate asks for 2 numbers and an operator (must be either +, -, * or /) then will calculate the value. If the result is a number is greater or equal to 999999999, it leads to an error. However, 0 / 0 = 0 and other division rules still apply. Calculate Function
  • Build asks for a size and something that it can build, which could be either a line, tower, wall, or pyramid. If the size is more than 20, it leads to an error. It would then ask for the character you want to use to build it, then it will be used to build the final product. There are multiple errors here, which is explained at the Error function.
    Build FunctionDisappointed that I can't make a proper pyramid.
  • Error is a library that shows all 14 errors, which is listed in the Error page of this post.
  • Feedback asks for feedback from the user and they can type whatever they want. The input will then be transferred in a new file called Feedback.list.

Feedback Function

Inside Feedback.list: What's in here?

  • Help displays the info of the entire app. Help Function


There are 14 written errors to prevent writing the real errors.

  1. NO_FUNCTION_ADDED: When asking for which function to use, entering a non-existent one will result to this error.
  2. ERROR_CLASS_NONE: In Error, entering a number which doesn't have its error will pop this up.
  3. COUNT_MAX: Well, typing a number greater than 50 won't put up the error, but counting up to 50 will.
  4. INVALID_DIVIDE: Anything divided by 0 in Calculate (except 0 / 0) will put up this error.
  5. ExTREME_VALUE: In Calculate, earning a final number of 999,999,999 or more will result to this error.
  6. OVERSIZE_CHUNK: Entering a size larger than 20 in Build will result to this error.
  7. UNKNOWN_STRUCTURE: Also in Build, inputting a structure unavailable will pop this up.
  8. UNCLEAR_INSTRUCT: If the input for Build's line is not vertical, horizontal or diagonal, they wouldn't know what it is.
  9. OVERWIDTH_COUNT: Building a tower with a width of 20 or more is invalid.
  10. INVALID_PYRAMID: Similar to Build's line, inputting a pyramid unavailable pops this up.
  11. OPERATE_BAD: Inputting an operator unavailable in Calculate is invalid.
  12. MORE_NAMES: If you didn't know, to run Kernel, you need to add your name alongside running it. Me, I use ./Kernel MarkGiraffe. If I use Mark Giraffe instead, it is invalid.
  13. SECRET_USER: Even NOT putting a name is not allowed.
  14. BAD_ALIGNMENT: Not choosing left or right for a diagonal line in Build is invalid.

For this challenge, I want you to remake the program the most designed way, while still keeping low bytes.

In case you are interested, I will post the source code somewhere where you can view it.

  • 5
    \$\begingroup\$ This has LOTS of quality issues. 1) Being a multipart challenge with unrelated subtasks. 2) Rigid I/O (command line arguments AND interactive stdin/stdout AND file output). 3) Input validation and error handling in arbitrary ways. 4) Lack of specification in certain cases. 5) Putting I/O examples in images instead of code blocks. \$\endgroup\$
    – Bubbler
    Mar 23 at 4:10
  • 2
    \$\begingroup\$ I think the outstanding question is, why would people want to code and golf here? Like, it's cool that you wrote a thing, but it seems like a lot of work for someone to re-do on a recreational programming site without a really compelling reason. \$\endgroup\$
    – xnor
    Mar 26 at 3:29

Given a program as input. If the program ever output a '1', output a truthy value and halt; if it halts without ever outputting a '1', output a falsy value and halt; if it falls into infinite loop without outputting a '1', fall into infinite loop.

  • \$\begingroup\$ This is unclear, for example: what language will the program be in? Do we take it as a string? And for a turing-complete language, this is impossible (at least if it can take input). \$\endgroup\$
    – Wezl
    Apr 2 at 15:45
  • \$\begingroup\$ @Wezl Why not?? \$\endgroup\$
    – l4m2
    Apr 2 at 16:09
  • \$\begingroup\$ You didn't specify the above ^ points, which are important. \$\endgroup\$
    – Wezl
    Apr 2 at 16:17

Poly-functional Polyglots

I don't have a ton of time to work on this, so I decided to remove it temporarily while I rework the scoring.

  • \$\begingroup\$ I think the scoring system is too convoluted. Optimizing for the bonuses seems like more of a challenge than completing the core task. And if number of languages is the denominator, it’s hard to know how to calculate that upfront. How many shells does echo “Hello World” work in? If I later learn about another one, does that retroactively lower my score? \$\endgroup\$ Apr 2 at 16:53
  • \$\begingroup\$ @water_ghosts thanks for saying so. I was worried that that would be the case, especially after reading the discussion on things to avoid in questions. I'm going to try and rework this. \$\endgroup\$ Apr 8 at 19:26

Generate a Printing Program In Some Language


Given some rules:

1: Hello
2: World
4: Code
7: Golf
9: Whatever

Your program should output a program or a function (the output), which should be a valid program (or function) in some language. When the output is run, it should

  1. Ask for some input (i),
  2. Then output the string in the ith index in rules. (If there are none, don't output anything - even an error.)
  3. Return to step 1.



1: Hello
5: World
19: Code

One possible output (python):

while True:
  i = int(input())
  if i == 1:
  if i == 5:
  if i == 19:


Your score is the bytes in your answer (not the output).

Obviously this question should be clarified.

  • \$\begingroup\$ Can we take input as an array of rules (2d, like [[1, "hello"], [2, "weijfiwef"]])? If the index is not in the rules list, can we output an empty string? \$\endgroup\$
    – user100690
    May 16 at 7:42
  • \$\begingroup\$ Well I thought about that, but some strong-type languages don't allow different types in a same array. If the index is not in the rules list, you can't output anything (as said in step 2). \$\endgroup\$ May 16 at 8:33
  • \$\begingroup\$ Is my output required to be a full program or it is allowed to be a function? \$\endgroup\$
    – tsh
    May 17 at 7:21
  • \$\begingroup\$ Yes @tsh, can be either full program or function. \$\endgroup\$ May 17 at 14:09
  • \$\begingroup\$ Why downvotes? Could you please explain why? I'll improve \$\endgroup\$ May 17 at 14:19
  • \$\begingroup\$ @SketchySketch Not a downvoter, but it seems to be a boring challenge. \$\endgroup\$
    – Xwtek
    May 20 at 9:18

Given two reals \$a\$ and \$b\$, output some reals \$r_i\$, such that \$\sum r_i=a\$ and \$\prod\left(r_i+1\right)=b\$. You can assume that it's possible. You can also assume that your float type have infinite precision.

Test cases:

2,3 => 2 or etc.
2,4 => 1,1 or 1/2,(sqrt(57)+9)/12,(9-sqrt(57))/12 or etc.
2,5 => 1/3,1/2,2/3,1/2,0 or etc.
2,8 => sqrt(17)+2,2-sqrt(17),-2 or etc.
2,2 => sqrt(2)+1,1-sqrt(2) or etc.
e,2e => 1,e-1 or etc. (e is natural base, though any number>1 work)
-4,9 => -2,-2 or etc.
0,-1 => sqrt(2),-sqrt(2) or etc.

Shortest code wins.


  • Though I only removed two positives from the existing question, it's a huge change to the result.
  • I decide to keep the assume possible part just to make the note above correct. It can actually be proven that it's always possible.

Breaking BogoBogoSort (In Badness)

The title says it all - make a sorting algorithm with a time complexity of \$O(n!^{n!})\$ or higher in the fewest bytes possible - as far as I can tell, that will require you to make a double exponentiatial formula or worse: that is, \$O(a^{b^n})\$, where \$a, b > 1\$.

Rules (since there must be some)

The list must be returned sorted in a finite time. This can be as high or as low as you want.

The algorithm must work for any real numbers (-30% if you can sort any single type given it's non-mixed).

The algorithm must work of any list length, and must eventually outpace ALL \$O(n!^{n!})\$ formulas, not just BogoBogoSort, and you must state the exact \$O\$ growth rate (for example, \$O(2^{3^n})\$). It may start off slow, but must eventually outpace all other expo-factorial functions (as I now name this growth rate).

Shortest code wins.

  • \$\begingroup\$ What prevents someone from doing a loop just to make it slower (or calculating \$ n!!!! \$, etc.), and then just sorting the array with quicksort? \$\endgroup\$ Jun 5 at 8:00
  • \$\begingroup\$ Logic. Logic prevents them from doing something that the question didn't mean you to do. Standart loopholes are forbidden by default \$\endgroup\$ Jun 7 at 8:25

Get the Collatz Sequence

The Challenge

Write a full program or function that, when given an integer \$n \ge 0\$, outputs all steps of the Collatz Sequence (A006577) of \$n\$.

The Collatz Sequence

The Collatz Sequence is defined as: $$ a(n) = \begin{cases} n/2, & \text{if $n$ is even} \\ 3n+1, & \text{if $n$ is odd} \end{cases} \text{while n > 1} $$


Input is some integer \$n \ge 0\$.


Output is the sequence of numbers visited while calculating the Collatz Sequence, while the output is greater than 1.

Additional Rules

Test Cases

n -> sequence
0 -> [0]
1 -> [1]
2 -> [2, 1]
3 -> [3, 10, 5, 16, 8, 4, 2, 1]
4 -> [4, 2, 1]
5 -> [5, 16, 8, 4, 2, 1]
6 -> [6, 3, 10, 5, 16, 8, 4, 2, 1]
7 -> [7, 22, 11, 34, 17, 52, 26, 13, 40, 20, 10, 5, 16, 8, 4, 2, 1]
8 -> [8, 4, 2, 1]
9 -> [9, 28, 14, 7, 22, 11, 34, 17, 52, 26, 13, 40, 20, 10, 5, 16, 8, 4, 2, 1]
10 -> [10, 5, 16, 8, 4, 2, 1]
15 -> [15, 46, 23, 70, 35, 106, 53, 160, 80, 40, 20, 10, 5, 16, 8, 4, 2, 1]
20 -> [20, 10, 5, 16, 8, 4, 2, 1]
25 -> [25, 76, 38, 19, 58, 29, 88, 44, 22, 11, 34, 17, 52, 26, 13, 40, 20, 10, 5, 16, 8, 4, 2, 1]
30 -> [30, 15, 46, 23, 70, 35, 106, 53, 160, 80, 40, 20, 10, 5, 16, 8, 4, 2, 1]
35 -> [35, 106, 53, 160, 80, 40, 20, 10, 5, 16, 8, 4, 2, 1]
40 -> [40, 20, 10, 5, 16, 8, 4, 2, 1]
45 -> [45, 136, 68, 34, 17, 52, 26, 13, 40, 20, 10, 5, 16, 8, 4, 2, 1]
100 -> [100, 50, 25, 76, 38, 19, 58, 29, 88, 44, 22, 11, 34, 17, 52, 26, 13, 40, 20, 10, 5, 16, 8, 4, 2, 1]
9329 -> [9329, 27988, 13994, 6997, 20992, 10496, 5248, 2624, 1312, 656, 328, 164, 82, 41, 124, 62, 31, 94, 47, 142, 71, 214, 107, 322, 161, 484, 242, 121, 364, 182, 91, 274, 137, 412, 206, 103, 310, 155, 466, 233, 700, 350, 175, 526, 263, 790, 395, 1186, 593, 1780, 890, 445, 1336, 668, 334, 167, 502, 251, 754, 377, 1132, 566, 283, 850, 425, 1276, 638, 319, 958, 479, 1438, 719, 2158, 1079, 3238, 1619, 4858, 2429, 7288, 3644, 1822, 911, 2734, 1367, 4102, 2051, 6154, 3077, 9232, 4616, 2308, 1154, 577, 1732, 866, 433, 1300, 650, 325, 976, 488, 244, 122, 61, 184, 92, 46, 23, 70, 35, 106, 53, 160, 80, 40, 20, 10, 5, 16, 8, 4, 2, 1]
4637823 -> [4637823, 13913470, 6956735, 20870206, 10435103, 31305310, 15652655, 46957966, 23478983, 70436950, 35218475, 105655426, 52827713, 158483140, 79241570, 39620785, 118862356, 59431178, 29715589, 89146768, 44573384, 22286692, 11143346, 5571673, 16715020, 8357510, 4178755, 12536266, 6268133, 18804400, 9402200, 4701100, 2350550, 1175275, 3525826, 1762913, 5288740, 2644370, 1322185, 3966556, 1983278, 991639, 2974918, 1487459, 4462378, 2231189, 6693568, 3346784, 1673392, 836696, 418348, 209174, 104587, 313762, 156881, 470644, 235322, 117661, 352984, 176492, 88246, 44123, 132370, 66185, 198556, 99278, 49639, 148918, 74459, 223378, 111689, 335068, 167534, 83767, 251302, 125651, 376954, 188477, 565432, 282716, 141358, 70679, 212038, 106019, 318058, 159029, 477088, 238544, 119272, 59636, 29818, 14909, 44728, 22364, 11182, 5591, 16774, 8387, 25162, 12581, 37744, 18872, 9436, 4718, 2359, 7078, 3539, 10618, 5309, 15928, 7964, 3982, 1991, 5974, 2987, 8962, 4481, 13444, 6722, 3361, 10084, 5042, 2521, 7564, 3782, 1891, 5674, 2837, 8512, 4256, 2128, 1064, 532, 266, 133, 400, 200, 100, 50, 25, 76, 38, 19, 58, 29, 88, 44, 22, 11, 34, 17, 52, 26, 13, 40, 20, 10, 5, 16, 8, 4, 2, 1]


For Meta

  • Is it clear?
  • Any corrections?
  • \$\begingroup\$ I'd consider this a duplicate of the current Collatz challenge, as the only way to find the length is to generate the sequence, so the answers will all be doing the same thing, just without a length call tacked on the end \$\endgroup\$ Jul 31 at 16:38
  • \$\begingroup\$ That is what I've always wondered, though, is how we have a length of Collatz challenge but not a Collatz sequence generation challenge \$\endgroup\$
    – bigyihsuan
    Jul 31 at 19:58
  • \$\begingroup\$ Because there is no way to determine the length of a Collatz sequence without generating it, so the core of the challenges would be the same - generating the Collatz sequence. \$\endgroup\$ Jul 31 at 20:00

Shortest common superstring

Your challenge is to find the shortest common superstring (SCS) for a sequence of English words. The SCS for a sequence is the smallest string that contains all the words in the sequence. The words should be passed as a function parameter.

Answers should be posted in the following format:

<Language name>, <Byte count>


This is code-golf, so the answer with the least bytes wins.

Any suggestions?
  • 1
    \$\begingroup\$ I wouldn't suggest using a popularity contest for a task that looks like it can be code-golf. However, this is likely a duplicate. caird will be around in a while with a more length message and a link to a dupe :P \$\endgroup\$
    – user
    Aug 18 at 18:53
  • 1
    \$\begingroup\$ Welcome to Code Golf, and thank you for using the Sandbox first! Unfortunately, this is a duplicate. \$\endgroup\$ Aug 18 at 19:03
  • \$\begingroup\$ Ok, well that's fine. \$\endgroup\$
    – Alan Bagel
    Aug 18 at 19:04

Compress La Campanella.

Notice that music theory may give you more rules than general compress give, but I don't know music theory that much, so I won't post this


Every number is interesting

We know that every number is interesting but how?

You should write a program or function which:

  • takes a list of N positive integers (>0 and <2^31)
  • outputs N lines each of them showing how the corresponding input number is interesting
  • is not longer than 1024 bytes
  • uses no more than 1 second per number
  • doesn't use external sources


172: 444 in base6
5776: 76*76
9801: 9 * 1089 (reverse)
68101: no 11 in base2 (10000101000000101)
491033: 317 * 1549 (product of 2 big primes)
467808816: no digit 5 from base6 to base10


You should include the output for the following input in your post:

58 92 120 224 358 490 912 1578 7812 222008 1645060 19796411 550453633 

If you care to run your program on a bigger sample and share the result with us use this input data (2500 numbers). (You can upload your output to e.g. pastebin.)

This is a popularity-contest so highest voted answer wins.

Tags: popularity-contest, number

  • 1
    \$\begingroup\$ What sort of criteria are necessary for defining a number as 'interesting'? I see things like square numbers, other bases, etc. But are there any specifics? I'm interested in this challenge (but worried it might be closed as too broad). \$\endgroup\$ Apr 7 '15 at 13:18
  • \$\begingroup\$ @ASCIIThenANSI There wasn't a clear definition. That's part of the reason why I abandoned the challenge. \$\endgroup\$
    – randomra
    Apr 8 '15 at 1:55
  • 1
    \$\begingroup\$ Would you mind if I tried taking it up? I would have to post as a new answer, because I can't directly edit. \$\endgroup\$ Apr 8 '15 at 2:00
  • \$\begingroup\$ @ASCIIThenANSI Not at all. \$\endgroup\$
    – randomra
    Apr 8 '15 at 2:01
  • \$\begingroup\$ @ASCIIThenANSI Where did you post it? \$\endgroup\$
    – wizzwizz4
    Jul 24 '19 at 13:33
  • \$\begingroup\$ @ASCIIThenANSI I am also curious \$\endgroup\$
    – MilkyWay90
    Aug 27 '19 at 23:41

Create a Drawing Guide for a Polygram

Poor old Jim, he's just terrible at drawing polygrams, and he's asked you to create a "drawing guide" for him - an ascii polygram with numbered edges, so he can follow the instructions.


Write a program to produce an ascii polygram with P <= 10; each edge of the polygram should be made of a single digit 0-9, showing the order in which the edges should be drawn.


Your program should receive (via STDIN, as function arguments, or some other language-appropriate method): P, the number of edges/vertices of the polygram, and Q, the spacing. In the notation as per the Wikipedia link, you'll be drawing a {p/q} polygram.


Either print to STDOUT or return (or something else language-appropriate) a multiline string showing the drawing guide for the given polygram. The string can be any size you like, as long as it's large enough to display a clear polygram.


Your code should be able to handle compound regular polygons as well as regular regular polygons, and also inputs of q > p/2 (poor old Jim doesn't realize that the polygram for {p/q} is the same as for {p/p-q}).

Example Output for {10,3}

             5 4             
     21     5        888     
     2 11115     8888  7     
     2    5111888 4    7     
     2     888111  4   7     
     2  888      111   7     
     8885           4117     
  8882               4 711   
 8   2 5               7  111
     25               47     
 9   5                 7    0
  9  2                 74  0 
    52                 7  0  
   9 2                 7 4   
  5 92                 7 04  
     9                 70  4 
 5   2                 7     
5    29                7    4
6666 2 9              07   33
    666              0 7333  
     2 696           337     
     2   9666     333  7     
     2    9  66633 0   7     
     2      333 666    7     
     2   339       666 7     
     2333   9    0    67     
             9  0            


This is code-golf, so shortest in bytes wins. Tiebreaker goes to the most votes.

  • \$\begingroup\$ I have a python solution to this which is ~600 bytes, so it's definitely doable, and it's not easy... \$\endgroup\$ Apr 27 '15 at 4:31
  • 5
    \$\begingroup\$ I think the spec needs to be more prescriptive for this to make a good question, especially since the example seems to indicate that you're not currently even prohibiting the lines from having gaps. At a minimum I would say that you should require the lines to be equivalent to those produced by Bresenham's algorithm, and specify how overlaps should be handled; at the extreme, you could tie it down so tightly that it becomes a parameterised kolmogorov-complexity. \$\endgroup\$ Apr 27 '15 at 9:34

Pointer to pointers to pointers to pointers

You should choose a language supporting pointers like C. And your task is simple: demonstrate a legitimate use of the most level of pointers.

You should justify your code by describing an algorithm that:

  • Has only plain text, number or an array of those as input and output.
  • You think it will make things easier to write those code as a part of the implementation of this algorithm.
  • This implementation would have optimum memory usage (only declared variables and parameters, explicitly allocated space, and the return addresses for recursive functions count).

Other rules:

  • They must be pointers to pointers directly, i.e. a pointer to an object containing a pointer doesn't count. It's better if nobody using this code will want to extend some pointer to an object later.
  • Each pointer must have a different type (if your language can somehow make them the same type).
  • You should create at least one pointer, and either dereference or compare two non-null pointers once in each level.
  • Using pointers as arrays is only half as interesting.
  • Iterators, etc, are considered in essence pointers and allowed in this challenge. But you can't define new types implementing iterators for this purpose.

  • 3
    \$\begingroup\$ Could you specify "legitimate"? This sounds a bit like code bowling (and seems to have the same issues). With enough imagination I'm sure I can justify any depth of pointers. \$\endgroup\$ Apr 30 '15 at 17:43
  • \$\begingroup\$ @MartinBüttner Edited but, basically, it is subjective. \$\endgroup\$
    – jimmy23013
    Apr 30 '15 at 17:57
  • \$\begingroup\$ @MartinBüttner Added a restriction to have optimum memory usage. I'm not sure whether it works. \$\endgroup\$
    – jimmy23013
    Apr 30 '15 at 18:19

Winning Tic-Tac-Toe lines

For a given tic-tac-toe board of size N**D (for example, a normal tic-tac-toe game is 3**2), the number of winning lines of length N is given by the expression:

$$ 2^{D-1} + \sum_{S=1}^{D-1}2^{S-1}DN^{D-S} $$

(Basically, you are summing the number of lines in each S-dimensional slice of the board.)

The challenge:

Given N and D, your answer should output a list of D-dimensional coordinates for each winning line. Input and output are any reasonable format. You can assume that both N and D are positive integers, with N > 1. (Degenerate cases of N=1, D>1 not included.)

Since this is , fastest answer wins. Please explain your algorithm!

  • \$\begingroup\$ How do you intend to determine which of two answers is fastest? \$\endgroup\$ May 12 '15 at 19:37
  • \$\begingroup\$ yes, @randomra made the same point on chat. i'll edit this in, but i guess... i'll put together some test cases and then time them? i dunno, i was going back and forth between this and code-golf, but i'd prefer interesting and readable algorithms. \$\endgroup\$ May 12 '15 at 20:10
  • \$\begingroup\$ i posted this here because i really want the answer, and i hate coming up with brute force solutions... :D \$\endgroup\$ May 12 '15 at 20:16
  • 2
    \$\begingroup\$ Um. Given that you're asking people to enumerate an exponentially large set, in what sense will the answers not be brute force? \$\endgroup\$ May 12 '15 at 20:28
  • \$\begingroup\$ well, there's brute force and then there's brute force. but really it's because i don't want to do it myself, haha. \$\endgroup\$ May 12 '15 at 20:34
  • \$\begingroup\$ also, making use of symmetry can severely reduce the computation. \$\endgroup\$ May 12 '15 at 20:40
  • 1
    \$\begingroup\$ I imagine that the runtime in any such algorithm will be basically proportional to the number of things you print, so there won't be any good way to improve by algorithm and the speed will be very platform-dependent. \$\endgroup\$
    – xnor
    May 12 '15 at 23:40

Ayn Random number generator

Inspired by xkcd 1277:

enter image description here

Write a random number generator that takes no input and generates a random integer between 1 and 100. When run less than 200 times, the frequency of all numbers needs to be between 0 and 2, but when it's ran 50 000 times, the number 42 (obviously) should have a frequence that's more than 4 standard deviations higher than the mean.

Format is code-golf. Your score is the bytecount of your code.

  • 1
    \$\begingroup\$ 1. I think it's difficult to decide objectively whether a PRNG appears to be fair at first sight. 2. The term more often should probably be quantified. \$\endgroup\$
    – Dennis
    May 18 '15 at 21:49
  • \$\begingroup\$ I see lots of C rand()%1000 and the like incoming... \$\endgroup\$
    – rorlork
    May 18 '15 at 22:05
  • \$\begingroup\$ @Ypnypn I have changed the criteria to have much lower numbers so they're easier to verify. \$\endgroup\$
    – Nzall
    Jun 6 '15 at 13:04
  • 1
    \$\begingroup\$ @Dennis I have rewritten the question to clarify what "being fair" is and what "more often" actually entails. \$\endgroup\$
    – Nzall
    Jun 6 '15 at 13:05
  • 1
    \$\begingroup\$ 1. Are you thinking of a standalone program that you run multiple times or a function that is allowed to keep a state? In the first case, not even a perfect RNG will, with overwhelming probability, satisfy the first condition. 2. Do you mean the mean and standard deviation of a perfect, uniform RNG or the one the code implements? \$\endgroup\$
    – Dennis
    Jun 6 '15 at 23:44
  • \$\begingroup\$ @Dennis I'm thinking of just a function AynRandom() that gets called. The frequency of numbers with a small number of iterations is subject to change, maybe from 0 to 4. The mean and Standard Deviation must be the one the code implements. \$\endgroup\$
    – Nzall
    Jun 7 '15 at 9:49
  • \$\begingroup\$ between 0 and 2 ? so print 42 would be a valid program ? \$\endgroup\$
    – Falco
    Jun 11 '15 at 15:32
  • \$\begingroup\$ @Falco No, because 42 would appear more than 2 times (unless you only run it twice). The problem is that I need a way to indicate that the RNG is fair with a low iteration count, but unfair with higher iteration counts. The only way I can make it work is by stating that with low iteration counts, all numbers should appear about equally often, which is either 0, 1 or 2 times. \$\endgroup\$
    – Nzall
    Jun 11 '15 at 15:36

Please nitpick this. If there's anything that wouldn't work or would be inconvenient, however small of an issue it is, tell me about it!
Also, suggestions for [adjective] are more than welcome.

Determine how [adjective] a number is ()

A number would be considered [adjective] if 0 is the result of multiplying its digits together, then multiplying the digits of the resulting number, then repeating until a single-digit number is produced. The more steps it takes to reach 0, the more [adjective] the number is; if the resulting number is not 0, though, the number is not [adjective] regardless of how long it took to finish.
The formula used to determine [adjective]-ness is 10-10/T where T is however many numbers it took to reach 0 (including 0 and the initial input)

Your goal is, as the title says, to write a program or function that determines how [adjective] a number is, and prints every iteration along the way. Here are some example inputs/ouputs:

in: 879
out: 879    <-       (T=1)
     504    <- 8*7*9 (T=2)
     0      <- 5*0*4 (T=3)
            <- optional newline
     6.6... <- 10-10/3 (repeating decimals can be expressed in any way you want)

in: 2468
out: 2468   <-  T=1
     96     <- (T=2) 2*4*6*8
     54     <- (T=3) 9*6
     20     <- (T=4) 5*4
     0      <- (T=5) 2*0

     8      <- 10-10/5

in: -888
out: -888  
     -512   <- -8*-8*-8
     -10    <- -5*-1*-2
     0      <- -1*0

     6.6... <- 10-10/3

in: 1344
out: 1344

     0    <- did not produce 0, so the prog/func returns 0

Your program must follow these rules:

-Takes input from STDIN.
-Throws an "error" (printed to STDOUT) and halts immediately after input if the input has one or more 0s in it or if it's less than three digits in length. The error must be a string, and as it's supposed to be printed to stdout, cannot be one generated by the language itself (eg 1/int(min(input())) to check if it's zero). Lastly, the error message has to clearly define what the error is; ERR:0 and ERR:LEN, for example, would suffice.


-25 if it properly handles decimals. For instance, an input of 99.22 would first turn into 9*9 + 0.(2*2), or 9*9 + 0.4, and so on.

This is , so the shortest answer in bytes wins.

  • 4
    \$\begingroup\$ I don't like the +15 penalty. Whether strings are used is vague in some languages. The constant amount +15 is too little deterrent for some languages but huge for very concise ones. The fact that you've found a short solution you don't like is sign you should rethink the problem, not try to plug the hole. \$\endgroup\$
    – xnor
    Jun 17 '15 at 7:48
  • \$\begingroup\$ @xnor that's reasonable. I suppose it is a valid way of doing it, anyway, so I removed all mention of strings in that section. Should I also inc/decrease the bonus for decimals? \$\endgroup\$
    – hallo
    Jun 17 '15 at 22:29
  • \$\begingroup\$ The programming languages I know either don't allow throwing user-defined errors or print them to STDERR. Now, if you just want us to print a message and exit immediately... \$\endgroup\$
    – Dennis
    Jun 17 '15 at 23:32
  • \$\begingroup\$ ...and should be printed to STDOUT. I had a feeling that wasn't clear; I edited it, is it better now? \$\endgroup\$
    – hallo
    Jun 17 '15 at 23:33
  • \$\begingroup\$ It's the word throw that throws me off (no pun intended). To throw an error usually means something rather specific. Print an error message to STDOUT (or closest alternative) would be less confusing in my opinion. Also, since this is code golf, I think you should require specific error messages. There's no fun in losing a contest because you chose ERR:LEN and somebody else got away with EL. \$\endgroup\$
    – Dennis
    Jun 18 '15 at 3:16
  • 5
    \$\begingroup\$ Remove bonuses altogether. It's in the list of things to avoid. \$\endgroup\$
    – mbomb007
    Mar 1 '16 at 21:31
  • \$\begingroup\$ The error if the input contains a zero seems like a separate challenge. It may be better received if there is only one challenge. There is community support for avoiding Chameleon challenges. \$\endgroup\$
    – trichoplax
    Aug 10 '16 at 11:40

Wrong tool for the task


Write two full programs in the same programming language that solve the following two tasks:

  1. Read two positive integers from STDIN and print their sum to STDOUT.

  2. Read two positive integers from STDIN and print their product to STDOUT.

Additional details:

  • Given enough time and memory, your programs has to support arbitrarily large integers.

  • All integers (input and output) use standard decimal notation, have no leading zeroes and are followed by a single linefeed.


The first task is code golf, so your objective is to make your program as short as possible.

The second task is code bowling, so your objective is to make your program as long as possible.

Your score is defined as follows:

score formula

The highest score wins!

Robbing a language

There's a catch! Only the submission with the shortest program in a particular language will be considered valid for task 2, so there can only be one valid answer per language.

This means that you cannot deliberately write a huge program for task 2; you actually have to pick the "wrong tool" for the task.

Additional details:

  • Task 1 exists merely to provide the proper denominator for the score (and robbers have no moral anyway), so byte-per-byte copies of somebody's program for task 1 are allowed.

  • If two answers use the same language and have programs of the same length for task 2, the answer that achieved that length first will be considered valid.

  • If somebody invalidated your answer, you may attempt to golf your answer to revalidate yours and invalidate his.

  • \$\begingroup\$ I suspect this will come down to people writing code in unary and disagreeing on what input/outputs formats are valid for such a language. \$\endgroup\$
    – xnor
    Jul 20 '15 at 20:17
  • \$\begingroup\$ @xnor I'm not sure I understood your comment. The format for I/O is purposedly restrictive, so an answer's validity should be clear-cut. \$\endgroup\$
    – Dennis
    Jul 20 '15 at 20:25
  • \$\begingroup\$ @feersum I think the log scoring does benefits unary. Say (making up numbers) task 1 takes 100 chars of BF and task2 takes 150 chars. Then, those are translated to 300 chars and 450 chars of binary, and so 2^(300) and 2^(450) chars of unary, giving a score of 1.5. In comparison, if the tasks take 20 chars and 50 chars in another language, that's about a score of 1.3. I guess this is surmountable though (20 and 100 gives 1.5). \$\endgroup\$
    – xnor
    Jul 20 '15 at 20:33
  • \$\begingroup\$ Are the inputs decimal numbers? For a language like BF, can the numbers be taken as byte values rather than characters? What separator should be used between the numbers? Are leading zeroes OK in the output? I think you'll have to be pedantic and precise about everything given how much of the character count may depend on details, but it's doable. \$\endgroup\$
    – xnor
    Jul 20 '15 at 20:35
  • \$\begingroup\$ Yeah that's right, it is only for Unary. \$\endgroup\$
    – feersum
    Jul 20 '15 at 20:37
  • \$\begingroup\$ @xnor All integers (input and output) use standard decimal notation, have no leading zeroes and are followed by a single linefeed. \$\endgroup\$
    – Dennis
    Jul 20 '15 at 20:42
  • \$\begingroup\$ @Dennis Wow, you anticipated everything and I missed it. I take it then that input must be as a string of numerical characters? Also, do I understand right that you have to print a newline for output (say, print a+b,"\n" in Python)?. \$\endgroup\$
    – xnor
    Jul 20 '15 at 20:45
  • \$\begingroup\$ @xnor Yes to both. The newline is required and you have to use numerical characters. I'd specify the exact character range, but I don't want to exclude non-ASCII languages.I'll think of a way to make it clearer. \$\endgroup\$
    – Dennis
    Jul 20 '15 at 20:51

GitHub Gist command-line client

Create a command-line tool that publishes a list of files as one public GitHub Gist.


The following bullet points describe the behavior of the program. If a bullet point has "must", you must implement that point. If a bullet point has "can optionally" or "should optionally" you can implement that point on your own volition.

  1. It must be a complete command-line program.
  2. It must use the GitHub Gists API.
  3. It must post an anonymous Gist (that is, not as a GitHub user).
  4. Gisted files must use the filename provided on the command-line.
  5. The command-line must accept multiple positional arguments.
  6. If no arguments are specified, it must print this usage to STDOUT: gist: usage: <file> [file...] verbatim then exit with code 0.
  7. If something else goes wrong, it must print this message to STDERR: gist: unable to gist =( verbatim then exit with code 1.
  8. If everything is successful it must print the Gist's HTML URL to STDOUT.
  9. It can optionally accept a flag for description -d <description. floor(score * .9)
  10. It can optionally accept a flag for private gisting -p. floor(score * .9)
  11. In the case that a description flag is not used or implemented it must set the description to an empty string.

Example Input/Output

The number before the prompt is the exit code of the previous command.

0 $ gist
gist: usage: <file> [file...]
0 $ gist no-such-file.txt
gist: unable to gist =(
1 $ gist hello.txt
0 $


This is a so shortest answer wins. As stated above, the following multipliers are in effect:

  • (9): score = floor(score * .9)
  • (10): score = floor(score * .9)
  • Both (9) & (10): score = floor(floor(score * .9) *.9)
  • \$\begingroup\$ What's up with the Example Input/Output code snippet? The editor's preview displays it correctly. \$\endgroup\$
    – Winny
    Jul 27 '15 at 20:17
  • 2
    \$\begingroup\$ For the usage, should those literal strings be used regardless of the name and invocation of the program, or should it substitute the correct invocation for the leading gist? I'm thinking particularly of cases like Java, which doesn't support hashbangs. \$\endgroup\$ Jul 27 '15 at 20:32
  • \$\begingroup\$ Literal string, I think. \$\endgroup\$
    – Winny
    Jul 27 '15 at 20:34
  • \$\begingroup\$ That's a good point about Java. I think I'll remove the item about shebangs since it's unfair. \$\endgroup\$
    – Winny
    Jul 27 '15 at 20:41
  • \$\begingroup\$ If both bonuses are done, is it floor(score * .9 * .9), or floor(floor(score * .9) * .9)? \$\endgroup\$
    – Maltysen
    Jul 27 '15 at 23:48
  • \$\begingroup\$ Also, if the bonuses are done, do we have to make the usage string reflect that, or just print it verbatim? \$\endgroup\$
    – Maltysen
    Jul 27 '15 at 23:50
  • \$\begingroup\$ Output strings verbatim. And floor(floor(score * .9) * .9) for both. I'll update the question momentarily. \$\endgroup\$
    – Winny
    Jul 28 '15 at 2:07
  • \$\begingroup\$ I'm curious why this challenge is being downvoted. \$\endgroup\$
    – Winny
    Jul 28 '15 at 2:28

Golf these arrays

Your task is to output these 128 arrays: http://pastebin.com/UeBMJfv7

Gzip base64: (too long, will be added if I'll post this question).


  • You don't have to output them all. And you can output the arrays in any order. But the order of items in the arrays must be kept as is.
  • You can print other arrays, which wouldn't be counted towards your score. The number of arrays you print must be no more than 10,000, and the total number of arrays, subarrays and numbers must be no more than 10,000,000.
  • You can use any convenient format to represent the arrays (and the list of outputted arrays).


If your program or function has n bytes, and it printed k distinct arrays from the above list, your score would be n*(128/k)2. Lowest score wins.


It looks too boring.

  • \$\begingroup\$ It also looks too broad. \$\endgroup\$ Aug 8 '15 at 7:55

The Perfect Keyboard

Back in the 1970s, keyboard designers respected the needs of programmers and languages. For example, see the IBM 2741 keyboard, designed for APL (from Wikipedia):
enter image description here

Today, sadly, most code golfers are forced to struggle with standard keyboards, which are badly suited to the needs of their language. This has to change!

The challenge

  1. Choose a programming language.
  2. Design a keyboard, which would best suit the needs of a developer (or specifically a code golfer) in said language.
  3. Post the keyboard layout as an answer.
  4. Explain how your keyboard enhances the programming experience.
  5. Start counting votes for 7 days, until I acceopt the winning answer (the answer with most votes).
  6. Optional - if you are the winner, start a Kickstarter project to build the thing.

Expected Answers

This section is, of course, for the sandbox only.

I don't really expect a keyboard design which would actually improve functionality of programs in an actual serious language. I'd expect fun answers, where the keyboard design highlights soemthing fun/interesting/absurd about the language. But my expectations don't matter so much, because it's not me rating the answers, but the other users.

Example (not very good ones):

  1. A Brainfuck keyboard with only 4 keys.
  2. A Lisp keyboard where half the keys are parentheses.
  3. A Piet keyboard - I'm sure someone will come up with something nice.

  • 6
    \$\begingroup\$ I'm note sure if it's a valid challenge since there is no programming actually involved in answering this \$\endgroup\$
    – Fatalize
    Sep 3 '15 at 9:28
  • \$\begingroup\$ @Fatalize, You're right, but it is a programming-related challenge. It requires knowledge of programming languages and people may find it interesting or amusing. I may be pushing the boundaries, I don't know. \$\endgroup\$
    – ugoren
    Sep 3 '15 at 9:45
  • 2
    \$\begingroup\$ I would personally be ok with that challenge but I don't know if other, more prominent users would find this challenge off-topic. \$\endgroup\$
    – Fatalize
    Sep 3 '15 at 9:48
  • 2
    \$\begingroup\$ Judging from this Meta post, there seems to be a fairly clear consensus that a question must involve programming to be on topic, not merely be programming related. So this question is fairly clearly not valid. \$\endgroup\$
    – isaacg
    Sep 3 '15 at 10:08
  • \$\begingroup\$ You could always include programming the driver or some kind of special interface for the keyboard \$\endgroup\$
    – Beta Decay
    Sep 3 '15 at 10:28
  • \$\begingroup\$ @BetaDecay, This challenge is about crazy creative answers. Requiring a driver implementation seems to me like a way to kill this creativity. \$\endgroup\$
    – ugoren
    Sep 3 '15 at 11:01
  • \$\begingroup\$ @isaacg, trichoplax writes "I judge it by whether the answers to it demonstrate skill and determination, or just aesthetic style" - I think a good answer to this challenge requires undestdanding a language and designing something that relates to its properties. Does it qualify as "skill and determination"? I can't say I'm sure. \$\endgroup\$
    – ugoren
    Sep 3 '15 at 11:06
  • 1
    \$\begingroup\$ The art/programming debate was specifically about popcon questions where the answers were programs. There's no doubt whatsoever that a popcon where the answers are just images would be an art question rather than a programming question. On the same basis, this is not a programming question, and does not belong on this site. \$\endgroup\$ Sep 4 '15 at 13:58
  • \$\begingroup\$ @PeterTaylor - I don't think it's an art question. The challenge isn't to get a pretty picture of a keyboard, but to design something that suits the language in an interesting way. But I posted it here to get the communities opinion, and it seems quite clear what it is. \$\endgroup\$
    – ugoren
    Sep 5 '15 at 19:00
  • \$\begingroup\$ Since I wrote that meta answer the rules on popularity contests have been tightened up, and I think that is a good thing. I stand by my answer, but I think it is right that popularity contests be judged strictly, to reflect the fact that it is very difficult to write one that is a good fit for the site. \$\endgroup\$
    – trichoplax
    Sep 4 '16 at 11:56
  • \$\begingroup\$ Although it's possible someone will come up with an ingenious approach to designing a keyboard, the challenge itself seems to lean towards "make me laugh" rather than "impress me". This is why I don't think this is a good fit for the site. \$\endgroup\$
    – trichoplax
    Sep 4 '16 at 12:03
  • \$\begingroup\$ I'd love to see what keyboards the community comes up with, but I think it would need to be hosted somewhere other than main. For things which are appealing to the PPCG community, but not quite a fit for main, there's Code Golf Chat. People often post "mini challenges" which aren't well specified enough to be challenges on main, but can end up inspiring people to write a full challenge. \$\endgroup\$
    – trichoplax
    Sep 4 '16 at 12:06
  • \$\begingroup\$ I think it's important to keep testing the boundaries of existing winning criteria, and to try to come up with new ones. The people who put the effort into this will have a long run of rejections, but I really hope these don't come across as "don't try". \$\endgroup\$
    – trichoplax
    Sep 4 '16 at 12:19

This and this gave me an idea, but I'm not quite sure if this can be done at all, or if it is trivial. If it is, maybe point out how it could be changed to be interesting.

Anti golfing - Write the longest program not repeating any character

Well, it's just what the title says. Finally you're allowed to use as much bytes as possible.


  • The code of the program or function should not use any character that is used in the code before.

  • Your program should print some sort of result to stdout, or into a file or return a value. You're not allowed to output or return the empty string or only a newline.

  • Other than that your program might do anything. Read input, print lots of output, or what you can think of, but you have to explain what it does, of course.

  • Only characters in the ASCII range [32 .. 126] and newlines are allowed, which limits the maximal code length to 96 bytes.

  • Variable names are only allowed to consist of a single character

  • String literals or the like are forbidden. They could be used to hold the unused characters (though they would need two " in most languages anyway).

  • The same rule applies for similar literal constructs like blocks or what else is there in some languages.

  • Even if the length of a string literal would be used to generate a number, it is forbidden.

  • Variables can not just be declared and never be used. They have to be reflected in the output somehow.

  • If you've read and understood the above rules and still found a loophole and used it, you should go and stand in the corner for a while, thinking about what you've done.

So all in all, only use characters for actual code that does something generating the output, might it be calculating a value or formatting. And don't put unused characters somewhere in your code as a literal. Numbers are an exception, but I guess it's no problem to use them anyway.

I guess you should have a pretty good idea of what would be considered cheating here.

Example in awk

BEGIN{gsub(a,9);print $j-13+d^c/4*5678%20}

It prints 15.5, score is 42.

It replaces the empty string a with 9 in $0, which is the empty string in the beginning. So $0 becomes 9.

Then it prints the result of 9-13+1/4*5678%20.

($j is $0 (==9), because j is not defined

d^c ist 1, because c and d are not defined)

Please don't invent languages for this ;)

The longest code in bytes wins.

  • 1
    \$\begingroup\$ Are you sure you want to allow ASCII 127? That's the unprintable<DEL> character. The main problem with this challenge is "only use characters for actual code that does something". This is essentially unenforceable, because there may be arbitrarily complicated no-ops in the code. It's also why most code-bowling challenges fail to be popular/interesting. \$\endgroup\$ Sep 14 '15 at 7:32
  • \$\begingroup\$ Well, I thought about making it a "most votes win" challenge, but I guess that would be unfair for less known users. I don't know what could be done with what you are pointing out. \$\endgroup\$
    – Cabbie407
    Sep 14 '15 at 7:51
  • 2
    \$\begingroup\$ I don't think this is a good candidate for a popularity contest. Popularity contests shouldn't be used as a cop out if the actual spec is a bit vague. They work best for challenges where the actual scoring criterion can be well specified but is more easily judged by humans than machines (e.g. "visually approximate a given image with these constraints..."). \$\endgroup\$ Sep 14 '15 at 7:54
  • \$\begingroup\$ Yeah, it's hard to formulate the rules for this. But I think it's not always about finding a winner anyway. Thought this might be fun. Resolved the character 127 situation btw.. \$\endgroup\$
    – Cabbie407
    Sep 14 '15 at 7:57
  • \$\begingroup\$ How could I change that rule? I'm thinking about "only use code that contributes to the generation of the output" \$\endgroup\$
    – Cabbie407
    Sep 14 '15 at 8:02
  • 2
    \$\begingroup\$ How do you define "contribute"? E.g. this GolfScript program prints the length of the block in {...} which is a convenient way to stuff all characters except in '"# in there. Do all those random characters actually contribute? In Slashes everything which isn't an unescaped slash is printed to STDOUT, so as long as I put \/ together, I can put any characters I want there and they'll all contribute. \$\endgroup\$ Sep 14 '15 at 8:07
  • \$\begingroup\$ Hmm, I thought this would be covered by forbidding string literals.. might think about extending that rule to blocks. Well, I'm not that fluent at esolangs. \$\endgroup\$
    – Cabbie407
    Sep 14 '15 at 8:10
  • \$\begingroup\$ It's trivial to use all possible 96 bytes. Trust me. If you really want to see the program I'm thinking of, I suppose I could write it, but I'm pretty sure it can be done. \$\endgroup\$
    – mbomb007
    Sep 16 '15 at 18:34
  • \$\begingroup\$ Yeah, I guess you're right. i have no idea how it would be done, but alright. \$\endgroup\$
    – Cabbie407
    Sep 16 '15 at 20:10
  • \$\begingroup\$ Not to mention this is pretty much a duplicate of codegolf.stackexchange.com/questions/30159/… \$\endgroup\$ Aug 6 '17 at 12:52

Technologic - Now what's THAT command do??

Daft Punk's song "Technologic" is all about actions that a user or computer does when it's working and being used. You goal is to write a program that has one command we will call the Technologic Command. This command will executes all of the actions like "buy it", "lock it", "code it", and "write it" in the order the lyrics are written on 'it'. What 'it' is is up to you, but you gotta let me know.


  • Any language can be used.
  • The song refers to an 'it'. That can be a block a memory, algorithm, function, file, or anything else a computer can manipulate directly or indirectly.
  • You must specify what 'it' is you will be performing these actions on. If you don't, you can only earn a maximum of 160 points.
  • Points will be deducted otherwise if a command is not used.
  • I'm not aware of any 'buy' command, method, function, subroutine or instruction so use a thesaurus and find the closest word you can actually program. I don't expect the program to actually buy or snap anything. Other words like mail and fax are possible, but not recommended.
  • If you have to use a synonym, you are not allowed to use that command again
  • Encompassing multiple objects into one artifact does not count. For example, taking the command "name it" literally means you won't be able to name an array of bytes, but you can name a file. Creating an object that holds both a file and an array of bytes is not allowed. That would make this too easy to get the maximum amount of points.


  • There are 16 commands with a total possible score of 190 points.
  • 10 points for executing a command on the specified 'it' of your choosing (160 total)
  • 2 points for executing each command consecutively that references your 'it' (30 total)
  • 5 points for executing a command on something other than your 'it'
  • -3 points for every command skipped.

Command List


Buy it, use it, break it, fix it,
Trash it, change it, mail - upgrade it,
Charge it, point it, zoom it, press it,
Snap it, work it, quick - erase it,
Write it, cut it, paste it, save it,
Load it, check it, quick - rewrite it,
Plug it, play it, burn it, rip it,
Drag and drop it, zip - unzip it,
Lock it, fill it, call it, find it,
View it, code it, jam - unlock it,
Surf it, scroll it, pause it, click it,
Cross it, crack it, switch - update it,
Name it, rate it, tune it, print it,
Scan it, send it, fax - rename it,
Touch it, bring it, pay it, watch it,
Turn it, leave it, start - format it.

  • \$\begingroup\$ This conversation has been moved to chat. \$\endgroup\$
    – Dennis
    Sep 17 '15 at 21:06
  • \$\begingroup\$ I count way more than 16 commands here. There are 16 lines each with several commands on them. If we cound the hyphenated commands as two, there are 16 x 4 = 64 commands. \$\endgroup\$ Sep 22 '15 at 22:01
  • \$\begingroup\$ @steveverrill A slight oversight. haha. I must've counted the lines knowing there were 4 commands on each line and didn't multiply the two together. \$\endgroup\$
    – Luminous
    Sep 23 '15 at 12:31

Just Golf 2016

(Related: A Kingdom Hearts VGM challenge) Sandbox note: potential duplicate?

Just Dance 2016 is coming out soon, and I know I'm definitely excited! However, let's take a quick trip back to 2009, when the original Just Dance was released. There are a lot of great songs, but I don't know who sung half of them!

The Challenge

Write a program that accepts a Just Dance song name from input and outputs the song's artist (as credited in-game.)

Here is the list of all songs and artists from Just Dance 1:
list pending

Rules and Assumptions

  • You may assume that the song will always be valid.
  • The song's title and artist must be properly capitalized.
  • You may not read any external files - the song data must be hardcoded.
  • If a song is covered (which several have been for various reasons), the program should return the cover artist (as they are credited in the game.)

Test Cases

Input: Eye of the Tiger
Output: Survivor

Input: Fame
Output: Irene Cara


  • Each game has had one song everyone was really excited about. This year, it's Ievan Polkka by Hatsune Miku. You get a bonus of -50 points if you accept this song as valid input.

  • Just Dance is fun, but why should we stop there? If you additionally accept songs fron the rest of the main series (Just Dance 2, 3, Greatest Hits/Best Of, 4, 2014, and 2015, not including DLC and skipping over any duplicates), you get a whopping -2009 points. Here is the full list for those games:
    list pending

    • Note that this doesn't include Just Dance 2016 songs.
    • This can be combined with the other bonus to get a total of -2059 bytes.

Meta Questions

  • Are the bonuses too big? (I'm mainly talking about the -2009 point bonus for including every song.)
  • Has anything been left out?
  • Is this enough of a challenge?
  • 1
    \$\begingroup\$ This looks like a dupe of codegolf.stackexchange.com/q/53678/194 . \$\endgroup\$ Sep 24 '15 at 20:24
  • \$\begingroup\$ @PeterTaylor I would say it isn't, that one asks for input in the form of a game and boss and returns a song, mine asks for a song and returns an artist. That one also has different scoring rules, and mine requires all items to be implemented. \$\endgroup\$ Sep 25 '15 at 13:51
  • \$\begingroup\$ They're both "golf this given map / dictionary / associative array". Why would the techniques used be any different? \$\endgroup\$ Sep 25 '15 at 15:22
  • \$\begingroup\$ @PeterTaylor According to this meta post, the main qualification for duplicates is "Can answers from one question be copied over to the other with little or no modification and still be competitive?". I looked at the answers for the question you linked, and it doesn't seem like either would do very well if those techniques were used in this challenge. \$\endgroup\$ Sep 25 '15 at 15:35
  • \$\begingroup\$ Would this be kolmogorov-complexity? \$\endgroup\$ Sep 26 '15 at 17:16
  • \$\begingroup\$ @LegionMammal978 Yes. \$\endgroup\$ Sep 27 '15 at 14:48

Literally just printing the source code

Wait a second. We already have a contest where you print the source code. Right? Wrong.

The challenge

Print out the source code. Not to STDOUT, but to a physical printer.

The rules:

  • You must write a complete program that prints out its own source code with a printer connected to the computer.
  • No STDIN (or input of any kind), STDOUT, or STDERR.
  • No standard loopholes (includes no file input). No using lp(r/d) or similar commands.
  • The printed code should be a reasonable size (between size 8 and 18) and a legible font (pretty much means no wingdings).
  • You may assume that the user doesn't cancel the process and answers affirmatively to any system print dialogs.
  • You can assume that the printer works, is ready, doesn't need new ink/paper, etc.
  • If the language doesn't support printing, it is ineligible.
  • This is so shortest code, in bytes, wins.
  • \$\begingroup\$ This is a trivial extension of the quine challenge. All you have to do is say you're running it on Unix/Linux and pipe the output to lpr. \$\endgroup\$
    – user45941
    Nov 1 '15 at 22:21
  • 1
    \$\begingroup\$ This needs a much tighter spec on the hardware. E.g. I assume you would consider it cheating to post an ordinary quine and say "On this computer, all console output is also logged to a continuous print spool", but there are computers which are configured like that for audit reasons. \$\endgroup\$ Nov 2 '15 at 14:39
107 108
110 111

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .