12
\$\begingroup\$

I have an idea about a code-golf challenge.

Will I need to verify/test every answer submitted ?

Will I need to run code submitted to be sure that the answer meets the requirements ?

\$\endgroup\$
3
  • 1
    \$\begingroup\$ Added the code golf tag, since (as Dennis mentioned) the answers will be very different for other types of challenges. \$\endgroup\$
    – Martin Ender Mod
    Commented Feb 16, 2016 at 16:33
  • 1
    \$\begingroup\$ Related -- Untestable languages and On the subject of testing code \$\endgroup\$ Commented Feb 16, 2016 at 16:42
  • 2
    \$\begingroup\$ An important note for the flip side: this is why posting explanations/ungolfed versions is useful for more obscure languages, since it gives people more of a chance to at least verify your algorithm if they can't test it themselves. \$\endgroup\$
    – Sp3000
    Commented Feb 17, 2016 at 3:23

2 Answers 2

20
\$\begingroup\$

In an ideal world, you would. Practically, you normally can't — a) because of people using proprietary languages, b) because you might get many dozens of answers. Many answers will include a link to an online tester, especially those written in esolangs or golfing language specifically (but others also sometimes include links to ideone, or JavaScript answers might be runnable right there in a Stack Snippet). In that case, there's not really an excuse for not testing them.

But what about the rest? Focus on the most important answers. If you are planning to accept an answer make sure that it meets the spec by testing it. That normally means you just need to test the shortest submission — and if that turns out to be invalid, move on to the next shortest. In case you're unable to test the currently leading submission, you can still rely on the community to test it for you. E.g. you could pop into chat and ask whether someone would be able to test the code in question. Usually someone will be able to run the language. (Unless it's TinyMUSH...)

In addition to the answer you want to accept, you (and ideally everyone else) should make sure any answer works before even upvoting it. (Unfortunately, this is far from reality... I've seen answers get a bronze badge before anyone noticed it didn't meet the spec.)

\$\endgroup\$
1
  • 3
    \$\begingroup\$ +1 for the last paragraph. \$\endgroup\$
    – edc65
    Commented Feb 20, 2016 at 1:43
12
\$\begingroup\$

For code golf, you don't have to verify the answers yourself. Verifying all of them personally could be time-consuming or downright unfeasible (after all, not all languages are free and run on all platforms), so you can rely on the community to do this for you.

This will become a lot easier if:

  • The question has a clearly established validity criterion.

  • The question has test cases.

It is generally expected that the original poster (OP) will make a final decision in some corner cases. For this purpose, other users generally post comments like This answer does X but the question says Y. Is that allowed? and await a ruling from the OP.

Note that other types of challenges (in particular, and ) may require a lot more involvement from the OP.

\$\endgroup\$
2
  • 1
    \$\begingroup\$ To the "in particular" list, add king-of-the-hill. \$\endgroup\$ Commented Feb 17, 2016 at 10:11
  • 2
    \$\begingroup\$ Added. It's a lot more obvious with KotH though. When new users post fastest-code questions, they usually don't expect to actually time the answers. \$\endgroup\$
    – Dennis Mod
    Commented Feb 17, 2016 at 13:39

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .