Hot answers tagged

126 votes

Things to avoid when writing challenges

Cumbersome I/O formats Generally, allow flexible input and output formats. People want to write code to do your task of, say, composing permutations, not reading/writing numbers in a particular ...
xnor's user avatar
  • 144k
85 votes

Things to avoid when writing challenges

Rules inferred from test cases Test cases are examples for people to check their understanding of the spec and the correctness of their code. They should not replace an explanation of how the output ...
xnor's user avatar
  • 144k
82 votes

Default for Code Golf: Input/Output methods

Functions may take multiple arguments via currying For some functional programming languages like Haskell this is actually necessary, because only single-argument functions exist and functions with ...
79 votes

Things to avoid when writing challenges

Making assumptions about language features Unless you're writing a language-specific challenge, avoid terms specific to some class of languages, because these might not make sense for other languages ...
xnor's user avatar
  • 144k
76 votes

Things to avoid when writing challenges

Bonuses in code golf Digital Trauma wrote an answer about this, but I have harsher views on bonuses, so I'm posting to let people vote separately. Bonuses in code golf say things like "-30% of your ...
xnor's user avatar
  • 144k
75 votes

Things to avoid when writing challenges

Changing the challenge in the comments If something was unspecified in your challenge, or if you've decided to make a change to the challenge (Such as to close a loophole), don't just leave a comment....
isaacg's user avatar
  • 42k
74 votes

Things to avoid when writing challenges

Do X without Y This isn't always bad, but it's been a particular trap for beginners, so be careful. In the past, there were popular questions about doing a simple task but with the obvious method ...
xnor's user avatar
  • 144k
71 votes

Things to avoid when writing challenges

Explicitly disallowing or disadvantaging arbitrary (classes of) languages This has become much rarer recently, but the occasional challenge by a new user still includes it, so here as an answer to ...
Martin Ender's user avatar
63 votes

Things to avoid when writing challenges

Putting test cases in a hard to use format Supplying test cases is always a good idea, but people are more likely to use them (and thus have better tested code) if they can easily be copied and pasted ...
Calvin's Hobbies's user avatar
62 votes

Loopholes that are forbidden by default

Abusing native number types to trivialize a problem It is common practice to restrict challenges to cases where input, output and/or intermediate values of the algorithm of choice fit into the ...
59 votes

Things to avoid when writing challenges

Requiring minimum scores In short, don't post a code golf that says "Your code has to be shorter than 100 bytes" (the same applies to any other winning criterion). The usual motivation is that the ...
Martin Ender's user avatar
58 votes

Default for Code Golf: Input/Output methods

For stack-based languages, function's input may be pushed to the stack before calling Stack-based languages may assume that the input for their function is automatically pushed to the stack.
Addison Crump's user avatar
58 votes

Things to avoid when writing challenges

Chameleon challenges Chameleon challenges look like they're about one thing but are really about another. In doing the challenge, most of the effort is spent on something peripheral. Fix this by ...
xnor's user avatar
  • 144k
52 votes

Things to avoid when writing challenges

Non-observable program requirements The validity of a program should depend on things that can be observed when the program is treated as a black box. Examples are data written to standard output or ...
feersum's user avatar
  • 31.3k
51 votes

Things to avoid when writing challenges

Don't allow / ask for different things in languages with different capabilities Don't write specs like "Do X. If your language doesn't support X, you can do Y instead". Examples are: Do some math in ...
nimi's user avatar
  • 35.8k
45 votes

Things to avoid when writing challenges

"Ideally, your code will..." Avoid recommended features in your spec. If it's not mandatory, answers won't do it. The goal is to write the shortest/fastest/winningest code that still satisfies the ...
xnor's user avatar
  • 144k
44 votes

Things to avoid when writing challenges

Arbitrarily overriding the defaults The default code formats, input/output methods, and other defaults are a product of community thought and discussion. Don't change them just because you feel like ...
xnor's user avatar
  • 144k
44 votes

Things to avoid when writing challenges

Saying you should produce one or several outputs randomly without further specification One random output Say someone writes a challenge about generating a labyrinth of a given size (width and height) ...
Luis Mendo's user avatar
  • 104k
43 votes

Things to avoid when writing challenges

Requiring the use of unnecessarily "complicated" number types A large proportion of our challenges deal with numbers, or lists of numbers. An important consideration is always what sort of numbers ...
Martin Ender's user avatar
41 votes

Loopholes that are forbidden by default

URL shorteners / shortened URLs Every once in a while, we get a challenge that requires fetching some data from the internet. While some of them manage to ban URL shorteners in time, other don't. I ...
41 votes
Accepted

Is it OK to promote my own posts in chat?

Promoting your own posts is definitely OK, but there are some very important guidelines to consider. Promoting your own posts is usually OK if It's relevant to the topic of discussion. Hey, have ...
DJMcMayhem's user avatar
40 votes

Default for Code Golf: Input/Output methods

Programs may take input as the value of the last expression Using something like TI-84 BASIC's Ans, which is a variable that stores the value of the last ...
NinjaBearMonkey's user avatar
40 votes
Accepted

Definitive policy about answers not meeting the challenge specification

Scope As I see it, there are five types of invalid answers: Answers that produce incorrect results. This is the most common type, and usually an accident. Answers that produce correct results, but ...
Dennis's user avatar
  • 210k
39 votes

Default for Code Golf: Input/Output methods

Assembly programs may take input from registers If there are no I/O devices available, an answer might consist of a subroutine that reads its input values from the machine registers.
Lynn's user avatar
  • 68.2k
38 votes

Loopholes that are forbidden by default

When consistent and distinct values are asked as input, you cannot input complete or partial functions When I create a challenge and ask for a boolean or two '...
37 votes

Things to avoid when writing challenges

Allowing standard loopholes in general Don't say "Standard loopholes are allowed". They ban silly things like making up a language where the solution is a single character or just printing the string ...
xnor's user avatar
  • 144k

Only top scored, non community-wiki answers of a minimum length are eligible