While reviewing late answers, I came across Fixing a broken loop by changing exactly one character:

The following is a piece of C code, whose intention was to print a minus sign 20 times. But you can notice that, it doesn't work.

#include <stdio.h>
int main()
    int i;
    int n = 20;
    for( i = 0; i < n; i-- )
    return 0;

Well fixing the above code is straight-forward. To make the problem interesting, you have to fix the above code, by changing exactly one character. There are three known solutions. See if you can get all those three.

It seemed to be a good fit for , as the goal was to "solve" the problem in as few bytes of source code as possible, which corresponds to the help text that comes up when I moused over the tag (emphasis mine):

Code-golf is a competition to solve a particular problem in the fewest bytes of source code. Please flag new questions for moderator attention to be set to community wiki.

But then I started digging a little deeper and started reviewing the info page for the code-golf tag, and now I'm not so sure:

  • There should be a complete, unambiguous specification of the problem. It must include at least:
    1. How should the answer be presented — should a bare function be acceptable, or it must include full input/output code?
    2. The input format.
    3. The output format.
    4. A clear description of how the input and output are related.
    5. Explicit statement of any error checking or recovery that should be performed (because fragile solutions are, well, par for the course)
    6. Example inputs and outputs.

It doesn't seem like the above question meets any of these criteria.

Was I correct in re-tagging the question, or was my understanding of code golf naïve?

  • 7
    I don't think it's code golf, but I also do not think it's an appropriate question for StackOverflow. Voted to close. – Anthony Pegram Jan 2 '12 at 3:07
  • @AnthonyPegram why do you think it's off topic? – Josh Darnell Jan 2 '12 at 4:19
  • 5
    @jadarnel27, I thought it was not constructive. It was a question not asked in good faith about an actual programming problem, it was asking for a narrowly constrained solution, but it stipulated there were at least 3. So it's either asking for a list, or there are 3 correct answers, and neither outcome is a good fit for a StackOverflow question. A good fit for a puzzle or quiz site, sure. StackOverflow is not such a site. But that's just my interpretation, and I only have one vote. – Anthony Pegram Jan 2 '12 at 5:48
  • @AnthonyPegram An apt explanation. Good call =) – Josh Darnell Jan 2 '12 at 6:05

There is now a Stack Exchange site, called CodeGolf.SE for coding competitions and you can expect no new [code-golf] questions to be accepted on Stack Overflow. Nor do I consider this a really good candidate for CodeGolf.SE as it does not admit a variety of strategies for solving it.

It feels more like a quiz than a contest.