Hot answers tagged

125 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 ...
  • 141k
121 votes

Loopholes that are forbidden by default

Zero-length quines Considering an empty program a quine was original in the 1994 IOCCC. Over two decades later, if you can answer a question with an empty program and that question is scored by ...
98 votes

Default for Code Golf: Input/Output methods

Programs may output by displaying it on screen. This makes it possible to use languages like Vim script that can't print output directly to stdout. Example from this challenge: ...
  • 186
93 votes

Loopholes that are forbidden by default

Using a non-free language on a Cops and Robbers challenge Most (currently all) cops and robbers challenges consist of two parts: A cop submission, where a user posts some secret property of a ...
91 votes

Default for Code Golf: Input/Output methods

Programs may output using their exit code... Exit codes are basically a return value for programs. If functions can output using their return values, it makes sense that programs should be able to do ...
89 votes

Loopholes that are forbidden by default

Using prior knowledge to circumvent other loopholes In particular, gaining an unfair advantage by inventing new languages for future challenges that are being sandboxed, discussed in chat, are your ...
84 votes

Loopholes that are forbidden by default

Using MetaGolfScript MetaGolfScript is a family of programming languages. For example, the empty program in MetaGolfScript-209180605381204854470575573749277224 prints "Hello, World!". It is similar ...
83 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 ...
  • 141k
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 ...
78 votes

Default for Code Golf: Input/Output methods

The contents of the tape post-execution may be used as a Turing machine's output
  • 11.8k
77 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 ...
  • 141k
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 ...
  • 141k
72 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....
  • 41.5k
70 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 ...
70 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 ...
  • 141k
62 votes

Loopholes that are forbidden by default

Creating a new compiler for a language after a challenge was posted There is some debate arising from this answer. He created his own compiler for the C programming language that extends the language ...
62 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 ...
61 votes

Default for Code Golf: Input/Output methods

Functions may output by modifying their arguments or writing to out arguments Here, "out arguments" refers to arguments that are passed in by reference, so that modifying the value inside the ...
60 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 ...
58 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 ...
57 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.
55 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 ...
  • 141k
53 votes

Default for Code Golf: Input/Output methods

Programs may combine two or more input methods For example, if the inputs are a string and an int, a function that takes a string as an argument and an int from STDIN would be valid. The input ...
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 ...
  • 35.6k
50 votes

Default for Code Golf: Program, Function or Snippet?

Restricting to just programs requires explicitly specifying "full program" rather than just "program" If the question requests a program, this can still be answered with a function. This allows for ...
50 votes

Default for Code Golf: Input/Output methods

Where applicable, Turing machines supporting multiple halt states may also output via their halt state This is essentially equivalent to programs outputting via their exit code.
  • 11.8k
50 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 ...
  • 31.1k
49 votes

Default for Code Golf: Input/Output methods

Input for Turing machines may be written to the tape pre-execution The read-write head should start on the leftmost cell of the portion of the tape containing the input.
  • 11.8k

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