How do we handle standardizing things?
Code golf, being about exploiting things, often brings about many questions about edge cases. Since we don't want each challenge to have to deal with all problems again and again, it makes sense to standardize some defaults for questions about various topics (including, but definitely not limited to, what's a valid answer, what are allowed I/O rules, what's a quine, a program, a language, etc).
Codidact has help topics, customizable by moderators, but we still need some way to create the standards in the first place.
Proposal
Meta gets a new tag, named "standards" (or "defaults"; if you have name suggestions, suggest them!), addable to questions by moderators.
Such meta questions discuss a single topic, with each answer being a separate suggestion. Depending on the type of question, either the best voted answer is the accepted standard (e.g. quine definition), or all answers above some certain threshold of votes (what specifically should that be?) is counted as a default (e.g. a single input or output rule, as there can be many).
Since it can be useful to post answers with the express intent of them being downvoted to signify that something is not acceptable, the answers on these questions shouldn't give reputation, if possible.
These posts could, afterwards, be linked in the help pages, tag descriptions, or wherever else applicable.
This sounds like a great idea …
3y ago
Update: the meta tag is live, …
3y ago
Something I would like to see …
7mo ago
3 answers
Something I would like to see here are explicit and specific constraints on how submitted solutions are expected to accept the challenge input and output their solutions (if output is the goal).
For example, if a challenge states that your goal is to "find the string of least length in a list"... then all of the solutions below are valid, despite serving different purposes.
min(s,key=len)
a=min(s,key=len)
print(min(s,key=len))
import sys
min(sys.argv[1:],key=len)
import sys
a=min(sys.argv[1:],key=len)
import sys
print(min(sys.argv[1:],key=len))
I briefly (very briefly) looked around for some kind of template or ruleset, but I wasn't able to immediately find anything. This community would greatly benefit from a tab/link on the topbar/sidebar that points to a clearly defined set of rules and expectations for anyone wanting to post a challenge or submit a solution to a given challenge.
(This is a criticism, but hopefully not read as an angry one)
The challenge I'm working on is https://codegolf.codidact.com/posts/279434. This is a great challenge concept. My issue with it is that it is not clear how my solution should accept the challenge input, nor is it clear what constitutes a valid solution.
Given a list of strings(and optionally, their length) as input, weave the strings together.
I can make assumptions on how to accept the input, but the submitted solutions don't follow that assumption. Some take interactive input. Some assume the input is in some pre-existing variable (which makes golfing really easy, since accepting input or reading argv
would require extra characters).
Working out what is a "valid" solution is a bit harder, though. Does it need to be a function? Can it be assigned to a variable? Can it just be the bare-minimum code that you would assign to a variable? (See the code blocks above for an example.)
I know exactly how easy it is to make the mistake of not being clear enough in the requirements of a challenge. A few years ago, I posted a mini-challenge in the community I moderate in, where the challenge was to convert seconds into a human-readable format (aka convert 61
seconds into 1m, 1s
, with weeks being the maximum unit). I also explained to drop all 0
s (and their corresponding unit), so 60
seconds would become 1m
instead of 1m, 1s
.
I then gathered the submissions in order to measure the elapsed time of them. It was then that I realized my error. Nearly everyone had submitted something that outputted the solution rather than returned the solution. I asked them to resubmit their solutions as functions that returned the value instead, as writing to STDOUT adds extra time and skews the results.
I ended up having to revise the rules multiple times because I just underestimated how easy it is to misinterpret/misunderstand something unless you are annoyingly explicit about it.
The only standard rule I can think of is to make all challenge input be read into the program as a space-separated list of strings, and to make the program write the answer to STDOUT. This would make it really easy to verify whether the output is correct or not. At the very least, I think a template for challenge authors could be extremely useful. It could be like those default templates you see for GitHub issues, but for challenge problems instead.
Lastly, I apologize for my admittedly clunky writing. It's been years since I've wrote an essay. Also, if I've somehow just overlooked the ruleset, please yell at me.
Edit: The point I was mostly trying to make is that a template would help nudge challenge authors to be more descriptive and specific in their requirements. A hard ruleset probably isn't necessary. You can never have too much information, however.
This sounds like a great idea to me. To summarize how we can move forward on this:
For the Codidact Team
- Create a new meta tag (defaults? name pending) that is one of the options for the required tag on meta
- Create a new post type that applies to all posts and answers on posts with this tag that awards no rep for votes (and doesn't affect stats like sum of received votes)
For the Community
- Once the above is done, start creating rules topics!
- Some examples of good ones to start with (examples from SE) are I/O rules and loopholes
For moderators
- Once these posts exist and have enough answers, summarize them into help topics for the site.
3 comment threads
Update: the meta tag is live, so we can start the posts. I have created a few here with a few sample answers, but the rest is up to the community! Make sure to vote on other answers as well as post your own.
2 comment threads