46
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) ...
42
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 ...
Community wiki
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 '...
Community wiki
38
votes
Things to avoid when writing challenges
The prime numbers
We have 226 questions about prime numbers at the time of writing. Almost every single one of these involves some adaptation of the “canonical prime checking code” or the “canonical ...
38
votes
Things to avoid when writing challenges
Formulating the challenge as something and then including a twist that completely changes the task
Don't hide information from the reader. Don't enounce the challenge as something that later on it ...
38
votes
Accepted
What are our specific abbreviations and terms?
See also Stack Exchange Glossary - Dictionary of Commonly-Used Terms.
Abbreviations marked with a star (*) are chat specific.
ATO: Attempt This Online; a website similiar to TIO where newer versions ...
Community wiki
33
votes
Default for Code Golf: Input/Output methods
Submissions may use list of strings instead of multi-line strings
Input or output may be the equivalent of the string separated by newlines. For example, the multiline string:
...
Jo KingMod
- 47.5k
33
votes
Things to avoid when writing challenges
Input Validation
This is a subset of adding special cases for completeness that seems to come up pretty often. From a given set of possible inputs, a solution shouldn't have to sort out inputs that ...
Jo KingMod
- 47.5k
32
votes
Default for Code Golf: Input/Output methods
In languages without any method of input (e.g. ///) programs may get input through an insertion into the source code
28
votes
Default for Code Golf: Input/Output methods
Multiple arguments to a function can be taken as a list or tuple instead
For example, if you needed to take in two integers as arguments, you can take one argument: a list of both integers.
Apparently,...
27
votes
Default for Code Golf: Input/Output methods
Full programs may take array/string input (of unknown length) via stdin in the form of <length> <contents> or ...
26
votes
Default for Code Golf: Input/Output methods
Functions may return their result in an optional type wrapper
Relevant meta discussion.
By "optional type wrapper" I mean something like Maybe a in Haskell, ...
26
votes
Default for Code Golf: Input/Output methods
I/O for sequence questions may either be 0-indexed or 1-indexed
Any sequence question that has the user output the \$n\$th term, first \$n\$ terms, etc. of a sequence should allow programs to index ...
25
votes
Default for Code Golf: Input/Output methods
An array may be represented in input as a pointer and length.
For example in C you could use:
int f(int*p,int l){...}
25
votes
Things to avoid when writing challenges
Hidden pattern in the output for code golf challenges
You should not post a challenge in which an essential part is to find a pattern in the required output, which is not stated in the challenge but ...
23
votes
Loopholes that are forbidden by default
Using cryptographic functions in a cops and robbers challenge
Almost every cops and robbers challenge will have the following requirement:
Using cryptographic functions such as hashes or PRNGs is ...
Community wiki
22
votes
Loopholes that are forbidden by default
Using an inconsistent I/O format to encode information
For example, for a hypothetical challenge where the output could only ever be two or eleven, submitting the python program
...
22
votes
Things to avoid when writing challenges
Using old challenges as a model
Just because an old challenge did something doesn't mean yours should too. Many old challenges wouldn't pass muster nowadays. Don't be surprised if your challenge is ...
22
votes
Things to avoid when writing challenges
Excessively long back stories
This is a site for people who like programming challenges. They already want to see your idea for a challenge. You don't need a back story to make your challenge appeal ...
21
votes
Loopholes that are forbidden by default
Exactly duplicating another answer
This specifically came up for me in a king-of-the-hill contest. In particular, this contest had a random component, so replicating a submission could allow one to ...
21
votes
Default for Code Golf: Input/Output methods
black-box functions to be taken as input can be passed as an argument
This holds for functional languages or languanges that do have first class functions/anonymous functions/lambda functions or ...
21
votes
Default for Code Golf: Input/Output methods
You may assume that the input is valid
When parsing an input, you may assume that the input is already valid. You are not required to validate it unless the challenge is specifically about testing ...
20
votes
Default for Code Golf: Input/Output methods
Functions may return a function that returns the result
This is very similar to currying, the only difference being that only the first call includes an argument. Sometimes it's useful to curry a ...
20
votes
Loopholes that are forbidden by default
Sidestepping in a theorem-proving challenge
A theorem-proving challenge is about proving a statement (= constructing a value of the given type) given in a specific host language (designed for theorem ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
faq × 9discussion × 6
support × 5
policy × 4
defaults × 3
answers × 2
new-users × 2
code-golf × 1
tags × 1
sandbox × 1
chat × 1
challenge-quality × 1
winning-criteria × 1
flags × 1