12
\$\begingroup\$

The Code Golf stackexchange tour gives a detailed explanation on, how to ask a Code Golf question.
But what about how to answer? I have multiple questions about: How to give an answer?.
Neither the code golf nor the meta stackexchange seems to answer my questions:

  • Does the answer must be right? Let's take the example of a student, that try to solve a challenge for hours, and end up with half of a solution.
    Should he post it? Perhaps someone can help him in the comment, and they can form group to overcome this hurdle.
  • Do I necessarily have to aim for the shortest answer? If I have the choice between an elegant and short solution, how should I chose it.
    Also, let's say that I have a solution, but I know it is far from the shortest or the best solution, do I keep it for me?
  • Should I prioritize language with light syntax over verbose language. Like C or Java are really verbose, so If I post an answer in one of these language, will it be downvoted to the gut?
\$\endgroup\$
3
  • 4
    \$\begingroup\$ It’s likely you couldn’t find info about this because you were looking on the wrong meta site. Each site has its own meta. I’ve migrated this question to Code Golf’s. \$\endgroup\$
    – Catija StaffMod
    Sep 27, 2019 at 13:22
  • \$\begingroup\$ @Catija Thank you, I was new to the code golf, It wasn't easy to find the right place to find the answer. ^^ \$\endgroup\$
    – Hamza Ince
    Sep 27, 2019 at 13:24
  • \$\begingroup\$ Happy to help! Apologies if my last message seems brusque. On rereading it’s a bit terse. Good luck and have fun on Code Golf. There’s some great, helpful people here. \$\endgroup\$
    – Catija StaffMod
    Sep 27, 2019 at 13:30

2 Answers 2

15
\$\begingroup\$

Hello and welcome to CG&CC! Hopefully, this will clear some things up for you:

Must the answer be right?

Yes, answers to challenges must solve the challenge correctly. If you have a partially-working answer and need some help finishing it, try asking in chat - we're friendly.

Do I necessarily have to aim for the shortest answer?

You should always make a genuine attempt at optimizing for the winning criteria. For , that means you must make an effort to make your code as short as possible. For , that means you must make an effort to make your code as fast as possible. For other types of challenges, it will depend on the exact challenge.

Should I prioritize language with light syntax over verbose language?

You can answer in any programming language you like. Many people find cleverly-golfed answers in languages like Java to be more interesting than basic answers in very terse languages, so you might even get more upvotes. We generally don't downvote answers unless they're actually low-quality (like not optimized for the winning criteria).

\$\endgroup\$
4
  • 1
    \$\begingroup\$ Thanks, I'll have that in mind when I'll try to solve my first challenge. :) \$\endgroup\$
    – Hamza Ince
    Sep 27, 2019 at 13:48
  • 1
    \$\begingroup\$ Might be worth mentioning that, as well as asking in chat, it's often also acceptable to post a tips question to ask for help with a solution you're struggling to get working and/or golf. \$\endgroup\$
    – Shaggy
    Sep 27, 2019 at 22:08
  • \$\begingroup\$ What if, say, you've just learned a new language and you're trying to put your skills to the test? If you don't know how to golf very well in that language yet, is that not good? \$\endgroup\$
    – S.S. Anne
    Sep 29, 2019 at 0:00
  • 6
    \$\begingroup\$ @JL2210 So long as an attempt is made at optimization, it is fine. It's typically very obvious when an attempt is made versus not (e.g. shortening identifiers, minimizing whitespace, not using comments). \$\endgroup\$
    – user45941
    Sep 29, 2019 at 5:07
5
\$\begingroup\$

Hi and welcome to Code Golf SE!

1) Does the answer have to be right?
Yes. One of the fundamental pillars of this community is that all challenges have to have clear, unambiguous winning criterion, so that you can definitively compare two answers and determine which is better. That includes validity. A partially-working solution at 10 bytes versus a fully-working solution at 12 bytes isn't clear or unambiguous. See this answer from Martin for some methods to utilize a partially-working solution, and this answer from Dennis for further details on what constitutes a valid answer.

2) Do I necessarily have to aim for the shortest answer?
For challenges, yes. This is specified in further detail on the How to answer? pop-up when you start answering a challenge. If you have a really elegant or neat trick to show off, please understand that we request the shortest answer per implementation. So if the challenge can be answered by a brute-force solution in X bytes, but your elegant algorithm takes X+10 bytes, that's still an acceptable answer. See this post from Dennis for further discussion.

3) Should I prioritize language with light syntax over verbose language.
See above regarding the per-implementation scoring. In general, solutions are scored based on many factors, but just because you're answering in Java doesn't mean you're going to automatically get downvotes.

\$\endgroup\$

You must log in to answer this question.

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