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 requires more feedback, but it's been ignored, you can ask for feedback in The Nineteenth Byte. It's not only allowed, but highly recommended! Be patient and try not to nag people though, you might have to ask multiple times.

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".


4563 Answers 4563

141 142
144 145

Minimum Buttons on a calculator to get from one number to another

My calculator looks like this:

·   ·   ·   ·   ·
  1   2   3   +
·   ·   ·   ·   ·
  4   5   6   -
·   ·   ·   ·   ·
  7   8   9   * 
·   ·   ·   ·   ·
  =       0   /  
·   ·   ·   ·   · 

Given a starting number and a ending number, calculate the minimum sequence of button presses required to get from the starting number to the ending number.


  • / is integer division, no need to handle floats
  • Simple calculators always calculate from left to right, no complex order of operations
  • A = is needed at the end to display the final number if the start and ending number are different

Test Cases

A B Result
1 1
2 3 +1=
49 33 -16=
120 1081 *9+1=

More test cases TBD

  • \$\begingroup\$ Should there be an = at the end of the third test case? \$\endgroup\$
    – The Thonnu
    Apr 13 at 14:36
  • \$\begingroup\$ Isn't +97= a shorter solution for the last test case? \$\endgroup\$
    – Arnauld
    Apr 15 at 14:36
  • \$\begingroup\$ Is +961= also a valid answer for the last test case? \$\endgroup\$
    – The Thonnu
    Apr 15 at 16:54
  • \$\begingroup\$ @TheThonnu Yes. \$\endgroup\$
    – mousetail
    Apr 15 at 17:13
  • 2
    \$\begingroup\$ Must first button be one of "+-*/" or what happened if I press "1" at beginning? May input already equals to output? Could you add more testcases that require using more than 1 operators in the output? \$\endgroup\$
    – tsh
    Apr 18 at 5:51

What is the shortest python code which implements a string-to-float function?


Write the shortest variadic to_float, str2float, or standardizing function you can write subject to the constraint that the code is written in python.

Rules and Examples

The variadic str2float shall be some callable which accepts any one of the following inputs:

Input Data-type Example Input Output float
string "4.992" float 4.992
float s 4.992 float 4.992
int 9021 float 9021.0
a shallow iterable of strings ["4", ".", "9", "9", "2"] float 4.992
a string with zeros padded on the right and/or white-space padding on left "1234.650000\n" float 1234.65
a string with zeros padded on the left "016" float 16.0
a deeply nested iterable of strigs [["4", [[".", "9"]], ("9", "2")], ((((("1")), "0"), "1"), "0")] float 4.992101
a deeply nested iterable of a mix of floats, int, and strings [[4.0, [[".", 9]], (9, "2")], (((("1")), "0"), "10")] float 4.992101

The main assumptions about the variadic *args parameter are that there is a correctly-working method named __iter__ defined and that if you recursively search until isinstance(obj, str) returns True or not hasattr('__iter__', obj), then the object which is not a string has a __repr__ method which returns a string representation of a decimal point, integer, or floating point number.


The scoring will be something in between code-golf and popularity contest:

Score = (upvotes - downvotes) - floor((bytes in code that outputs question) / 3)

The highest score wins.

(You can use http://mothereff.in/byte-counter as a byte counter.)

  • 6
    \$\begingroup\$ It's not recommended to have popularity-contests any more. Also, it's not recommended to restrict the challenge to one language \$\endgroup\$
    – The Thonnu
    Apr 22 at 11:24

Infinitely spew corporate B.S.

(Throwing a touch of shade at some recent decisions made by StackExchange over on Mother Meta)

If you've ever read a company's announcement blog post or press release, you've likely thought to yourself "Wow, I couldn't understand a word of that!" This is the effect of a marketing technique often referred to as "spewing corporate B.S." which, while often frustrating to read, can help you and your business dodge a lot of bullets in the P.R. department (or at least, buy yourself some time).

After recent actions made by the company you work at, you've realized that your company doesn't have time to formulate a good response to its customers' concerns—but you know just how to deal with the problem.

In this challenge, your task is to write a program or function that, given no input (or a seed), infinitely writes randomized company-speak.

How to write it

SANDBOXING: TODO - spec out how this will work. I'm thinking that it will just choose random words from a word bank, but I should specify how grammar can work, or maybe it would make sense for the word list to be taken as input (leaning towards this)f? Please comment any suggestions.

Here are some example corporate sentences your program may write, according to the above criteria:

We are revisiting a broader approach to improving the user-experience of our new experiment concerning recent concern.

We are excited to share a more holistic initiative to produce positive results from our new experiment.

We are committed to hearing your feedback in a more positive exploration of the product.


  • Your submission can be a full- program or a function
  • You may return a generator that can generate sentences infinitely rather than printing.
  • Your “randomness” doesn’t have to be evenly distributed, but there must be a non-zero chance that any possible sentence might be outputted by your submission.
  • SANDBOXING: more rules
  • \$\begingroup\$ +1 for humor but needs to be a lot better specified. You need a objective scoring critereum at least \$\endgroup\$
    – mousetail
    May 31 at 12:47
  • \$\begingroup\$ @mousetail Sorry, it’s code-golf, forgot to mention. I don’t have time to update it yet but will do so in a few hours. It’s definitely not specified enough, since I’m still not entirely sure how the challenge will work—just wanted to post it so I A) don’t forget it, and B) can get some initial feedback on the idea \$\endgroup\$
    – noodle man
    May 31 at 12:48
  • \$\begingroup\$ How are you going to check if a answer is sufficiently corporate or sufficiently B.S.? \$\endgroup\$
    – mousetail
    May 31 at 12:48
  • \$\begingroup\$ Just make sure none of the SE staff notice… \$\endgroup\$ May 31 at 12:52
  • \$\begingroup\$ Is the output allowed to be a sentence that doesn't make sense? \$\endgroup\$ May 31 at 15:05

Detect sloppy randomness

The C rand() function is often implemented like so:

static unsigned long int next = 1;

int rand(void) // RAND_MAX assumed to be 32767
    next = next * 1103515245 + 12345;
    return (unsigned int)(next/65536) % 32768;

void srand(unsigned int seed)
    next = seed;

However this is not a very good rng and definitely not a cryptographically secure one. Your task is to write code that detects this rng.

Specifically your code takes as input a sequence of 100 (or fewer if you so wish) numbers between 0 and 32767 inclusive.

For a random input the code should output "random" with at least 99.9999% probability and "not random" with at most 0.0001% probability (one in a million).

However if the input is generated using (successive calls to) rand then your code must output "not random" always.

Also, your code must be fast. Specifically it should run in under a second. Output as per standard rules.


Should I use a 64-bit rng? Solutions in fast languages can probably just brute force the 31-bit state. This would also allow to relax the time requirements.

  • \$\begingroup\$ Under a second on what hardware? \$\endgroup\$
    – mousetail
    Jun 1 at 13:26

Inspired, maybe copy background from there

Given a map, output a shortest possible input.

Test cases:

Start here _ /  => / \

Start here _ /\/ => /// /\/ \/\

Start here _ /\/\ => //// //\\ /\/ \/\/

Start here _ /\/\/\/\/ => /\//\//\/ \/\//\// /\/\/\/\/ \\\
             \/\/\  /\    \/\/\\//\
              \   \/
  • \$\begingroup\$ What do you mean by shortest? Smallest number of paths? Do the paths also need to be shortest possible? (in your last example first or second path can skip the last / and the third I think is simply wrong (: ) \$\endgroup\$
    – pajonk
    Jul 13 at 6:09
  • \$\begingroup\$ @pajonk Sum new path, ` \ ` and /. Don't see problem on Test Case 3 or 4 \$\endgroup\$
    – l4m2
    Jul 13 at 6:16
  • \$\begingroup\$ In the last test case, third path, you have /\/\\//\/ but the 6th segment (first of two /s) doesn't exist in the map (or I don't understand something). \$\endgroup\$
    – pajonk
    Jul 13 at 9:48
  • \$\begingroup\$ @pajonk Misread as 3rd test case. \$\endgroup\$
    – l4m2
    Jul 13 at 10:32
  • \$\begingroup\$ It is unclear what the challenge is. \$\endgroup\$ Jul 13 at 11:37

Python: *args or **kwargs?

Is it a regular argument or a keyword argument?

In Python, there are two types of specifying arguments to a function:

Regular argument (arg): f("regular argument")

Keyword argument (kwarg): f(keywordarg="keyword argument")

Keyword arguments in Python always are in the form of variable assignments and regular arguments are anything else. If you want to learn more about *args and **kwargs, click here.


Given an input string consisting of only ascii characters that is a valid argument (regular or keyword), you must output one of two constant, distinct values representing whether it is an arg or a kwarg. Shortest code wins!

Test cases

3              -> arg
num = 3        -> kwarg
num=3          -> kwarg
a=b            -> kwarg
a==b           -> arg
False          -> arg
"kwarg"        -> arg
arg="arg"      -> kwarg
"kwarg=kwarg"  -> arg
a=b==c         -> kwarg
b==c           -> arg
[1,2,3,4]      -> arg
dict={1:2,3:4} -> kwarg
[1,2][i:=0]    -> arg

"""more than
one line!"""   -> arg

indeed more
than one line
'''            -> kwarg



  • Is this a duplicate?
  • Is this too focused on Python?
  • Do I need more test cases?
  • Any other feedback?
  • \$\begingroup\$ Explain the downvote. \$\endgroup\$ Jul 14 at 11:17
  • \$\begingroup\$ Can we assume ASCII only? \$\endgroup\$
    – mousetail
    Jul 14 at 11:32
  • \$\begingroup\$ @mousetail why are you asking? \$\endgroup\$ Jul 14 at 11:32
  • \$\begingroup\$ This question is just "does this string start with a valid python identifier followed by a =". But what constituted a valid identifier in python for weired unicode edge cases gets extremely complex. If you want unicode support you need a very large number of unicode test cases. \$\endgroup\$
    – mousetail
    Jul 14 at 11:34
  • \$\begingroup\$ @mousetail sure I’ll allow ascii only (but maybe a bonus for non-ascii as well?) \$\endgroup\$ Jul 14 at 11:35
  • \$\begingroup\$ codegolf.meta.stackexchange.com/a/8106/91213 \$\endgroup\$
    – mousetail
    Jul 14 at 11:36
  • \$\begingroup\$ @mousetail no bonus it is. \$\endgroup\$ Jul 14 at 11:38
  • \$\begingroup\$ @mousetail and about the valid identifier part: I said only valid arguments, so you won’t get £=1 or class. \$\endgroup\$ Jul 14 at 11:39
  • \$\begingroup\$ What if you get some weird Unicode character that normalizes to =? \$\endgroup\$
    – mousetail
    Jul 14 at 11:56
  • \$\begingroup\$ @mousetail i only allowed ascii \$\endgroup\$ Jul 14 at 11:58
  • \$\begingroup\$ £ is not ASCII \$\endgroup\$
    – mousetail
    Jul 14 at 12:02
  • \$\begingroup\$ @mousetail wait WHAT!?! \$\endgroup\$ Jul 14 at 12:03
  • \$\begingroup\$ @mousetail should we move this to chat? \$\endgroup\$ Jul 14 at 12:07
  • \$\begingroup\$ Let us continue this discussion in chat. \$\endgroup\$ Jul 14 at 12:07
  • \$\begingroup\$ Suggested test case [1,2][i:=0] is args \$\endgroup\$
    – mousetail
    Jul 15 at 15:12

Decimal to fraction

In the pool of questions on CGCC, I have not found a question with this task.

Given a float in base 10, output a fraction in simplified form, improper or mixed. The output format can be any reasonable one. In , the shortest answer wins!

Test cases

3.5 -> 7/2 or 3 1/2
0.25 -> 1/4 or 0 1/4


  • Did I miss a duplicate?
  • Any more test cases?
  • Anything else?

JSON Data? ASCII is better!

Write a function that prints JSON data using ASCII art, and takes a dictionary/object as input.


    "columns": ["firstname", "lastname"],
    "data": [
        {"firstname": "John", "lastname": "Doe"},
        {"firstname": "Jack", "lastname": "Barrock"},
        {"firstname": "John", "lastname": "Skeet"},


|  firstname  |  lastname   |
|     John    |     Doe     |
|     Jack    |   Barrock   |
| ...                       |

This is , so fewest bytes win.

Note: The input will always have a column attribute, and will always have a data attribute. Think of it as SQL.

  • \$\begingroup\$ Thanks for posting here. Some feedback: 1. Challenge should be fully specified before the test cases. Specifically, how the table is drawn, centered text, what characters are used for table formatting etc. 2. You need more test cases. At least 5 if you can cover all edge cases that way \$\endgroup\$
    – mousetail
    Jul 31 at 13:12
  • 2
    \$\begingroup\$ I'm not sure if you fix those that it would be sufficienly different from this challenge Arnould mentioned. Note challenges don't need to be identical to be duplicates, closely related challenges can also be closed if they have the same general structure for solutions. \$\endgroup\$
    – mousetail
    Jul 31 at 13:14

Worst algorithm for anything

Now, any coder worth their salt will know how to sort an array in-place in nlogntime. Most can probably figure out a way to do it in n!n time and factorial memory usage. Let's see an algorithm that tops those numbers; can you come up with a way to sort an array in up-arrow time? Can you come up with an algorithm whose O-notation contains the Graham's number series?


  • The algorithm must solve a problem that isn't just an obfuscation of 'do a ridiculous amount of NOPs".
  • Highest O-notation in either memory usage or time wins, tie broken by the other one and then by a golfed implementation.


I'm not sure whether I should limit this to solving a specific problem. For that matter, I don't know if this would be an interesting challenge.



A cat that writes to two streams? I’m in!

Write a full program with these properties:

  • If the input string ends in outerr, remove that part and write the rest to STDOUT and STDERR.
  • If the input string ends in err but not outerr, remove that part and write the rest to STDERR only.
  • If the input string ends in out, remove that part and print the rest to STDOUT.
  • Otherwise, print it to STDOUT unchanged.

STDOUT and STDERR can be replaced by a reasonable alternative. Also, STDERR is not ignored. However, insuppressible messages are ignored.

This is , so shortest code wins!


  • Ask away!
  • \$\begingroup\$ Does it have to be a program or are functions allowed? \$\endgroup\$ Sep 28 at 17:30
  • \$\begingroup\$ I assume when you say "remove that part and write it" you mean "remove that part and write the rest to"? \$\endgroup\$
    – noodle man
    Sep 28 at 17:40
  • \$\begingroup\$ @CommandMaster full programs only. Added. \$\endgroup\$ Sep 28 at 19:08
  • \$\begingroup\$ @noodleman yes. Fixed. \$\endgroup\$ Sep 28 at 19:09
  • \$\begingroup\$ What would be examples of "reasonable alternatives" for stdout and stderr? Would it be reasonable to output both to stdout, but with a separator? \$\endgroup\$ Sep 29 at 7:50

Write a check

Given the check (cheque, for non-Americans) number, payee, amount, and memo as input, print or return a check in this format:

| John and Jane Doe                                                      ***** |
| 123 Pine St.                                                                 |
| Anytown, USA 12345                                Date: ____________________ |
|                                                                              |
| Pay to the                                                                   |
|   order of _____________________________________________________ $__________ |
|                                                                              |
| ________________________________________________________________ DOLLARS     |
|                                                                              |
| First Bank of Code Golf - Anytown, USA                                       |
|                                                                              |
| For ________________________________  AUTHORIZED-SIGNATURE-JOHN-AND-JANE-DOE |
|                                                                              |
| [314159265[  2718281828/  *****                                              | 

Parts marked with underscores are for the account holder to fill out, while parts with asterisks are printed on the check.

  1. Fill out the check number in the top-right corner, left-padded with spaces. Check 101 has 101 in place of the asterisks.
  2. Fill out the check number on the bottom, left-padded with zeros. Check 101 has 00101.
  3. Anywhere the user writes, leave one underscore before the user's writing and as many afterwards as necessary to fill the space. You may assume your program will not be given input that will overflow any of the fields.
  4. Write the current date in the format November 2, 2023 (%B %-d, %Y).
  5. Write the numerical amount in the format 1,234.56. The comma is required for amounts greater than or equal to $1,000.
  6. Write out the amount in the format "One thousand two hundred thirty-four and 56/100". Pad the rest of the field for it with hyphens (-), except one underscore at the end.

Here is an example of check #9876 written on September 30, 2023, paying $1,234.56 to Acme Inc. for a Widget purchase:

| John and Jane Doe                                                       9876 |
| 123 Pine St.                                                                 |
| Anytown, USA 12345                                Date: _September 30, 2023_ |                
|                                                                              |
| Pay to the                                                                   |
|   order of _Acme Inc.___________________________________________ $_1,234.56_ |        
|                                                                              |
| _One thousand two hundred thirty-four and 56/100---------------_ DOLLARS     |                           
|                                                                              |
| First Bank of Code Golf - Anytown, USA                                       |
|                                                                              |
| For _Widget purchase________________  AUTHORIZED-SIGNATURE-JOHN-AND-JANE-DOE |             
|                                                                              |
| [314159265[  2718281828/  09876                                              |

Standard loopholes are prohibited. You may write a function or a complete program, and you may output the check to stdout or return it either as a newline-delimited string or as a list of strings. A trailing newline is optional.

  • \$\begingroup\$ Is the check itself part of the input or also generated by the code? \$\endgroup\$
    – Philippos
    Nov 30 at 11:59
  • \$\begingroup\$ @Philippos the check is generated. \$\endgroup\$
    – Somebody
    Nov 30 at 14:31
  • \$\begingroup\$ Then maybe there is too much stuff that cannot really be golfed. \$\endgroup\$
    – Philippos
    Nov 30 at 14:44
  • \$\begingroup\$ @Philippos do you think making it an input would be an improvement? \$\endgroup\$
    – Somebody
    Nov 30 at 15:36
  • \$\begingroup\$ "Fill out the check number in the top-left corner" You mean top right? \$\endgroup\$
    – Bbrk24
    Dec 2 at 3:18
  • \$\begingroup\$ Also, what's the maximum amount we have to handle? Can the limit be $999,999.99 or does it have to handle millions? \$\endgroup\$
    – Bbrk24
    Dec 2 at 3:20
  • 1
    \$\begingroup\$ @Bbrk24 oops, yes, top right. And it is limited to $9,999.99, because any more would overflow the numeric amount field. \$\endgroup\$
    – Somebody
    Dec 2 at 3:24

All good regex come in threes

We've had challenges about two regex matching each other but not themselves and a complicated relationship of five regex, but don't they say that all good things come in threes?

  • Write a chain of three regex, each one matching the next, but neither itself not the previous one
  • Thus, of our three regex, RE1 will only match RE2, RE2 will only match RE3 and RE3 will only match RE1
  • Don't ask about slashes. We are talking about regular expressions, not slashes. Even if some languages use slashes as one way to delimit regular expressions, the slashes are not part of the regular expressions, so they are not part of the challenge
  • If you use an extension to the POSIX regex standard, define our dialect and compete in that dialect league. Champions league is pure POSIX basic regular expressions
  • This is regex golf, so the shortest sum of the three lengths wins

Output Shakespeare with the highest probability

We all know that a monkey hammering out random bytes will output the works of Shakespeare with some probability. This probability is extremely low.

But what if the monkey would type out a computer program instead, and then we run the computer program and see if that outputs the works of Shakespeare? The program might output random text but with biases that make the works of Shakespeare much more likely to appear. That way, the overall probability of outputting Shakespeare might be much higher. But how much higher? Let's find out.

The essence of this challenge is to maximise the following probability:

p(the monkey outputs your program) * p(your program outputs the works of Shakespeare)

But to make that work as a practical challenge we have to introduce some rules and a little bit more maths, so read on.

This challenge is similar in spirit to my previous Write Moby Dick, approximately, but the scoring system is very different and this should lead to a significantly different challenge.

more details

The following file contains the complete works of Shakespeare in ASCII format. [to do: create the file and upload it somewhere]

In principle your program is meant to output random text, but we need to do that in such a way that we can calculate the probability of a given output. For most programming languages that isn't possible, so instead of having your program behave randomly we will have it output a probability distribution.

It works like this: your program (or function etc.) will be called multiple times (about 3,500,000 times). On each invocation it will be given the first n characters of bill.txt and it will output a probability distribution over ASCII characters, which is its probability of guessing a given next character. This output can be in any reasonable format - for example, it could be a Python array of 128 floats. But it must be a probability distribution, i.e. in this example the floats must sum to 1.

The following pseudocode shows how your score is calculated:

log_p_monkey_outputs_program = -(size of your submission in bytes)*8

log_p_program_outputs_shakespeare = 0
bill = contents of bill.txt
for n = 1 to length(bill)-1
    probabilities = your_program(first n characters of bill)
    correct_prob = probabilities[(n+1)th character of bill]
    log_p_program_outputs_shakespeare += log2(correct_prob)

score = log_p_monkey_outputs_program + log_p_program_outputs_shakespeare

The score that this program calculates is the logarithm of the probability that the monkey outputs your program and the program outputs Shakespeare, assuming that we always feed the program's output back in as input. We calculate the logarithm to avoid floating point errors, as the final probability will be extremely small. Note that the logarithm is to base 2.

If the scoring program is implemented correctly, the score will always be negative. A higher score (closer to 0) is better.

Note that your program outputs a probability distribution but it should not itself behave randomly. Your program may not use a random number generator - it must always return the same probability distribution for a given input.

If you want to store state in between invocations this is allowed. You can do this by writing to an external file, by using static or global variables, by submitting a class rather than a function, using a state monad, or whatever else works for your language.

Submission format

Your submission should include the following, which do count towards the size of your submission. If they are excessively large you can link to github etc.

  • your program
  • any data it needs in order to run

Your submission should also include the following, which don't count towards its size:

  • the code used to calculate its score, implementing the pseudocode above
  • any code that was used to generate your submission (e.g. to create any data files that you included)
  • an explanation of how your submission works.


As mentioned, your program must run deterministically, so that it always outputs the same probability distribution given the same input (and hence always gets the same score).

If at any time the value of correct_prob in the scoring pseudocode is 0, then your score is -∞, which is the worst possible score.

You may not use any libraries or functions that your language might have that include data or statistics about natural language. This includes pre-trained neural networks, word lists, etc. It also includes any built-in function that outputs any of Shakespeare's works. It's fine to use neural networks and word lists etc., but the data or weights must be included in your submission and count towards its byte count.

You may not use any libraries or functions designed for text compression. It's fine to use algorithms like bzip etc., but you have to implement them yourself (and hence include the implementation in your byte count).

Your submission should include the code used to calculate its score. (This doesn't count towards the byte count.)

If you want to store state between invocations you can do this however you like, as long as your program never has access to 'future' bytes from the bill.txt file. (So, for example, you can't just pass it a string containing all of the input and get back a big list of probability distributions as output.)

You must actually run your test program and calculate/verify your score before submitting your entry. If your submission runs too slowly for you to verify its score then it is not qualified to compete, even if you know what its score would be in principle.

You may import existing libraries other than the exceptions above, but you may not load any other external files unless they're included in your byte count. Your code may not access the bill.txt file in any way other than described above.

sandbox notes:

I'm unsure about the rule banning built-in compression algorithms. It seems more elegant to leave it out, but in Paint Starry Night, objectively, in 1kB of code they spoiled the fun a bit, and I'm worried that with this scoring system the same could happen here. I'm happy to hear any thoughts about that.

I'm also worried about this being closed as a duplicate of Write Moby Dick, approximately. That challenge was popular (it's the 12th highest scoring question on the site), but I wasn't really satisfied with it because the answers ended up being dominated by one method. I've been thinking for years about how to improve the scoring system so that that won't happen. A huge amount of thought has gone into what makes a good scoring system and why this one in particular should encourage more creative answers than the previous one - but that work isn't visible in the question text itself, so I'm worried that people will see two questions about predicting the next character in a text file and vote to close it. I welcome any thoughts about how to avoid this possibility.

I'd also really like feedback on the score calculation pseudocode - is it sufficiently clear how the score is calculated, and can I make it clearer?

Finally, a very specific query: the ban on word tables seems like it would rule out some golfing languages. I'm unsure whether I should make an exception for those, or if that would be seen as giving those languages an unfair advantage.

  • \$\begingroup\$ I'd say you can encode randomness into program, resulting in a pure "output Shakespeare shortest code" \$\endgroup\$
    – l4m2
    6 hours ago
  • \$\begingroup\$ @l4m2 if I understand correctly that would just make it a kolmogorov-complexty challenge. This is meant to be more of an optimisation challenge like Paint Starry Night or Write Moby Dick. I like Kolmogorov complexity challenges but these optimisation type challenges are quite different in terms of what makes a good answer, and that's what I'm going for with this question. \$\endgroup\$
    – N. Virgo
    6 hours ago
  • \$\begingroup\$ @l4m2 ah - or maybe you're saying that the optimal solution will be to compress the shakespeare file and just output it deterministically? If so that's a reasonable criticism but having done the maths I'm more or less certain it's not the case. \$\endgroup\$
    – N. Virgo
    7 mins ago
  • \$\begingroup\$ The point is that compressing the file in this way produces an optimal p_program_outputs_shakespeare but you have to include all the data in compressed form in the program, so you pay for it in p_monkey_outputs_program. If you can do some kind of lossy compression then you'll do worse at p_program_outputs_shakespeare but should be able to save more on p_monkey_outputs_program. So I expect the optimum to be some combination of compression and probabilistic guessing. \$\endgroup\$
    – N. Virgo
    25 secs ago

Underhand Bejewled

Help me to write a game of bejewled, which cannot be lost!

Bejewled game rules

If you ever played bejewled, you can skip this, but for those who did not see it ever:

  • Playing field of 8*8 grid is filled in with gems of 7 different types randomly
  • By swapping two adjective stones, your goal is to create a line of at least three same type of stones in the either vertical or horizontal line
  • If did so, the gems will dissappear, points are added (say 20 points for a matching) and new gems are provided randomly from the top
  • image related:

enter image description here

Your challenge

Provide me a game which cannot be lost. In other words, the gems falling from the top are not random at all, but are falling in order that there is always at least one possibility to match three gems

But, from looking at the code at level of newbie programmer, it should look like that game acts as if it was random


Playable game. As long as it is the grid of 8*8 filled in with 7 different types of "gems" the game is ok. It does not to have killer graphics, neither it does not need to be playable by mouse. (But in that case please make sure you show which "gem" is hovered and then selected)

Winning criteria

This is popularity contest. So highest rated game wins

  • 1
    \$\begingroup\$ I think this is too big a task to work well for an underhanded contest. The programs will be way too large for anyone to actually read the source and try to find what's underhanded about it. \$\endgroup\$ Nov 11, 2014 at 8:32
  • \$\begingroup\$ Thats what I was also afraid of. I will either take it as lesson to progress on my programming skill, or abandon the idea completly \$\endgroup\$ Nov 11, 2014 at 8:38

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, 2015 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, 2015 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, 2015 at 17:43
  • \$\begingroup\$ @MartinBüttner Edited but, basically, it is subjective. \$\endgroup\$
    – jimmy23013
    Apr 30, 2015 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, 2015 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, 2015 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, 2015 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, 2015 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, 2015 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, 2015 at 20:34
  • \$\begingroup\$ also, making use of symmetry can severely reduce the computation. \$\endgroup\$ May 12, 2015 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, 2015 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, 2015 at 21:49
  • \$\begingroup\$ I see lots of C rand()%1000 and the like incoming... \$\endgroup\$
    – rorlork
    May 18, 2015 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, 2015 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, 2015 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, 2015 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, 2015 at 9:49
  • \$\begingroup\$ between 0 and 2 ? so print 42 would be a valid program ? \$\endgroup\$
    – Falco
    Jun 11, 2015 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, 2015 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, 2015 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\$
    – user39326
    Jun 17, 2015 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, 2015 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\$
    – user39326
    Jun 17, 2015 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, 2015 at 3:16
  • 5
    \$\begingroup\$ Remove bonuses altogether. It's in the list of things to avoid. \$\endgroup\$
    – mbomb007
    Mar 1, 2016 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\$ Aug 10, 2016 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, 2015 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, 2015 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, 2015 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, 2015 at 20:35
  • \$\begingroup\$ Yeah that's right, it is only for Unary. \$\endgroup\$
    – feersum
    Jul 20, 2015 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, 2015 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, 2015 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, 2015 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, 2015 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, 2015 at 20:32
  • \$\begingroup\$ Literal string, I think. \$\endgroup\$
    – Winny
    Jul 27, 2015 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, 2015 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, 2015 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, 2015 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, 2015 at 2:07
  • \$\begingroup\$ I'm curious why this challenge is being downvoted. \$\endgroup\$
    – Winny
    Jul 28, 2015 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, 2015 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, 2015 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, 2015 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, 2015 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, 2015 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, 2015 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, 2015 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, 2015 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, 2015 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, 2015 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\$ Sep 4, 2016 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\$ Sep 4, 2016 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\$ Sep 4, 2016 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\$ Sep 4, 2016 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, 2015 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, 2015 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, 2015 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, 2015 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, 2015 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, 2015 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, 2015 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, 2015 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, 2015 at 20:10
  • \$\begingroup\$ Not to mention this is pretty much a duplicate of codegolf.stackexchange.com/questions/30159/… \$\endgroup\$ Aug 6, 2017 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, 2015 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, 2015 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, 2015 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, 2015 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, 2015 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, 2015 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, 2015 at 15:35
  • \$\begingroup\$ Would this be kolmogorov-complexity? \$\endgroup\$ Sep 26, 2015 at 17:16
  • \$\begingroup\$ @LegionMammal978 Yes. \$\endgroup\$ Sep 27, 2015 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, 2015 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, 2015 at 14:39

Restricted "Hello, World!"

The task is very simple, output Hello, World! to STDOUT. The thing that makes this different are the rules:

  • You need to provide a full functioning program, taking no input and outputting via STDOUT.
  • The program must not write anything to STDERR
  • The maximum amount of bytes you can use is 50
  • The program may only contain printable ASCII characters. Programs using CP437 and other encoding systems are not allowed
  • If a programming language is already used, you cannot use this same language again.
  • You cannot use any character of the prohibited character list. This is the twist:

Prohibited character list (PCL):

The prohibited character list is a list full of characters, which cannot be used in the following programs. For example:

If the list was: He\., you need to create a program, without the characters H, e, \ and .. These are not case-sensitive.

If you succesfully manage to write a program that doesn't use any characters, you may add new one character to the prohibited character list.


If the old PCL was He\., and you managed to write a program that doesn't use any of these characters, you may add a new character to this list. For example (whitespace). The new PCL will be He \. (notice that the whitespace character is added).

Posting Snippet:

This might help you wit posting your submission:

#[Language Name], N bytes


 (explaination etc.)

 Added character: [char]

 New PCL: [list + new char]

In the beginning, the PCL is empty. The last person who managed to create a program without a new program made in 2 days, wins!

I'm not really sure if it is flawed or not. If you have any suggestions or comments, feel free to post them below in the comment section :)

  • 2
    \$\begingroup\$ Already exists. \$\endgroup\$
    – Arcturus
    Nov 22, 2015 at 23:38

What day of the week is Christmas?

Christmas is coming quickly, which leads to the question, what day of the week is Christmas this year? But what day of the week is Christmas for any year? Write a program that can do this. This is code golf, so the shortest code wins!

However, there is a major twist. No builtin functions to do this task is allowed!


  1. If the program can handle B.C. years as negative numbers, then -25%
  2. If the program prints "The first Christmas!" for an input of -4 (4 B.C. is assumed to be when Jesus Christ was born), then -30 bytes
  3. If, for some reason, you really like builtins, +90%! So try NOT to use it!
  • \$\begingroup\$ The bonus for printing extra should be steeper, or no esolangs are going to go for it. \$\endgroup\$ Nov 29, 2015 at 1:45
  • \$\begingroup\$ @VoteToClose so more like 25% as well? \$\endgroup\$
    – TanMath
    Nov 29, 2015 at 1:48
  • \$\begingroup\$ No - I'd go static. Plus, this is really close to being a dupe... \$\endgroup\$ Nov 29, 2015 at 1:51
  • 2
    \$\begingroup\$ Near dupe of codegolf.stackexchange.com/questions/1003/… \$\endgroup\$ Nov 29, 2015 at 1:52
  • \$\begingroup\$ It's unspecified what format we should output in or what calendar we should use, and whether -4 should mean 4 BC or 5 BC. \$\endgroup\$
    – lirtosiast
    Nov 30, 2015 at 5:57
  • \$\begingroup\$ @ThomasKwa it should be obvious from the sentence that 4 B.C. is -4. Use the Gregorian calendar, output can be in MMDDYY \$\endgroup\$
    – TanMath
    Nov 30, 2015 at 6:09
  • \$\begingroup\$ How is MMDDYY a day of the week? \$\endgroup\$
    – lirtosiast
    Nov 30, 2015 at 16:32
  • \$\begingroup\$ @ThomasKwa sorry, it was pretty late when I wrote that so I mistakenly wrote MMDDYY. Just printing the day of the week is fine i.e. print "Sunday", "Monday", "Tuesday", etc. \$\endgroup\$
    – TanMath
    Nov 30, 2015 at 19:57

Golf A Wiki

The Challenge

Golf a wiki. A wiki, for the purposes of this contest, is defined as a website with:

  • Content editable by all
  • Easy CamelCase (defined as a word with two capitals) linking
  • Different pages or articles that are the targets of the links

Your wiki can be a self-contained HTML file (e.g. TiddlyWiki), or a cgi-bin script (e.g. SigWik).


Your score is the size of your program in bytes, divided by the number of extra features implemented plus one.

The possible extra features are:

  • Page history
  • Syntax for "nowiki", that is, something like <\noscript> in HTML that makes the text inside it not be wiki syntax.
  • A page list
  • A find page facility
  • Usernames and passwords (with registering)
  • Security levels (requires usernames and passwords, or possibly IPs?)
  • Delete pages
  • Change page titles
  • Redirects
  • Random page
  • Non-HTML formatting that is not just links [Should I remove this? I doubt it will be done.]

Lowest score wins, as this is code golf.



  • 3
    \$\begingroup\$ I would vote to close this as too broad. Among the problems I see: 1. The two given examples don't seem to be the same thing as each other 2. The complete lack of constraints mean that I could just automatically make every word a link. (This could be fixed by specifying one link syntax: for golfing I quite like the UseModWiki use of CamelCase for links). 3. I think I can get the "text formatting" feature for free by not escaping HTML characters. 4. Needs a big warning "Answers will likely contain major security flaws and should not be used on ports which are publicly visible" \$\endgroup\$ Dec 30, 2015 at 10:49
  • 1
    \$\begingroup\$ Ok, thanks, I'll edit when I have time today. \$\endgroup\$
    – Hipe99
    Dec 30, 2015 at 21:27
141 142
144 145

You must log in to answer this question.

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