16
\$\begingroup\$

Prompted by a discussion between Peter Taylor and myself, I'd like to solicit the community's opinion on the following issue:

Should awarding score bonuses for extra features disqualify a challenge from being tagged as , or is it enough that the primary scoring criterion is code length?

Also, does it matter if the bonus scores are only used to break ties between equally long answers (as in this challenge), or if the bonus can be formulated as an unusual length-counting rule (e.g. this challenge, where, effectively, the eight characters comprising the string "goldbach" are free if they appear in the code in that order)?


In particular, should the following questions (currently all tagged as ; not an exhaustive list) be retagged as ?

(List mostly compiled based on a search for [code-golf] bonus is:question, filtered to exclude simple false posistives and any questions where the bonus is "imaginary" or not well defined.)


The only written policy I've found on this is the tag wiki excerpt, which currently includes the following sentence (added by Peter in July '13):

"A competition which scores on a mixture of source length and some other criterion should be tagged [code-challenge] instead."

There doesn't seem to have been any meta discussion about this that I could find, so I figured I'd start one myself.

\$\endgroup\$
2
  • 3
    \$\begingroup\$ I didn't remember that I was the one who added that to the excerpt! I can't remember now what prompted it, but I think it was probably a rash of double-tagged questions. \$\endgroup\$ Commented Feb 19, 2014 at 21:19
  • \$\begingroup\$ Off topic but possibly helpful for future searches: you can golf is:question down to is:q. \$\endgroup\$ Commented Feb 25, 2016 at 12:18

4 Answers 4

12
\$\begingroup\$

No, bonuses should not be allowed in code golf

There's broad support that bonuses in code golf should generally be avoided. I think that moving bonuses from to would emphasize that bonuses aren't a twist you put in for the heck of it, but make for a different kind of challenge you should choose only if you consider the bonuses vital to the challenge.

The other argument is from purity. In , your goal is to minimize the number of bytes of the code. With scores like

112 bytes * 70% = 78.4 bytes

the resulting 78.4 isn't actually a byte count, but a score that's a function of the code length and the features it implements. So, it should be treated like any challenge scored on multiple factors, for which has been used as a "misc". (It might also be worth classifying 's into more specific tags.)

I disagree with ugoren's argument that these are still basically code golf.

... As long as modifications don't change the main focus, they don't change anything. In some extreme cases, the modifiers may become the main challenge, and golfing becomes more of a tie breaker. Then it shouldn't be tagged code-golf, but these are quite rare.

It would be great if it were just extreme cases, but often I see bonuses that steal the spotlight and are central to deciding a winner. Sometimes a bonus is so large that any competitive answer must do it, and other times it's a trap that's just not worth the bytes to implement. Choosing the right bonuses to achieve or ignore is often more influential than the quality of your golfing.

\$\endgroup\$
4
  • \$\begingroup\$ So what's your opinion on tie-breakers, and on non-standard length counting rules (like "the letter X is free")? Would you allow those, or should everything tagged code-golf just be decided by pure raw byte-counting? \$\endgroup\$ Commented Feb 21, 2016 at 2:10
  • 1
    \$\begingroup\$ @IlmariKaronen I'm not the poster, but I upvoted this, so I'll chime in with my 2 cents. Tie breakers are necessary because it's very reasonable to have two submissions with the same byte count. The standard way of going about this is that the first answer to reach that byte count wins. As for non-standard length counting rules, that should be code-challenge. To me, code-golf is purely "do this, shortest code wins". Any extra complexity in the scoring moves it out of golf territory. \$\endgroup\$
    – user45941
    Commented Feb 21, 2016 at 4:45
  • 3
    \$\begingroup\$ @IlmariKaronen I'd limit code golf to raw byte counting. We've seen that even the small modification of "X is free" allows exploits like encoding the program as a long string of X's. I wouldn't be opposed to custom tie-breakers though. \$\endgroup\$
    – xnor
    Commented Feb 21, 2016 at 21:26
  • \$\begingroup\$ Important note: this answer is not saying "you should not add bonuses to code golf challenges". It is saying "if you add bonuses to a code golf challenge, it is no longer a code golf challenge, and should be tagged as code challenge". \$\endgroup\$
    – user45941
    Commented Mar 11, 2016 at 14:42
11
\$\begingroup\$

I don't thing the tag needs to cover all nuances.

If the main task is to write the shortest program that achieves a task, it's code golf. As long as modifications don't change the main focus, they don't change anything.

In some extreme cases, the modifiers may become the main challenge, and golfing becomes more of a tie breaker. Then it shouldn't be tagged code-golf, but these are quite rare.

Also, I'm not sure when is appropriate. Isn't everything on this site a code challenge? I think it's mostly used for challenges that don't match any specific tag.

\$\endgroup\$
2
  • 2
    \$\begingroup\$ The code-challenge wiki says it's "a competition for creative ways to solve a programming puzzle with an objective winning criterion not covered by other scoring tags (e.g. code-golf)", i.e. it's the catch-all tag for when no other scoring tag applies but the challenge is still on topic. \$\endgroup\$ Commented Feb 20, 2014 at 14:16
  • 1
    \$\begingroup\$ The current text on the code-golf tag does suggest that many things currently tagged code-golf ought to actually be tagged code-challenge. \$\endgroup\$ Commented Feb 20, 2014 at 14:19
5
\$\begingroup\$

I have never been very worried about questions, but if they are bothering people or if people like them enough to want them to be searchable, how about a new tag?

Something like .

We already have proposals and active tags for some other "special" golfing rules.

\$\endgroup\$
0
\$\begingroup\$

I think there are some cases where mixed criteria could make sense in pure code-golf, although most of the examples given are not those cases. The primary case being a challenge where not only the program but also the solution can be (purely and objectively) golfed.

For example The 3L and 5L Jugs (aka Die Hard) challenge is a case where there are many ways to solve for a given number but there is also an optimized solution for each number. It would have been reasonable to score that challenge on a combination of code length and number of total steps required to solve all numbers 1 to 100. To my mind, both of those are golfing criteria: optimization to reduce the size of the solution. And the net effect is that you discourage people from reducing the size of their program by reducing the quality of their solution.

A bonus like the -8 points for Goldbach, on the other hand, is not a golfing bonus. It certainly introduces a legitimate element of fun and challenge, but it also introduces a meta-gaming aspect in which you have to consider the choice to implement the bonus feature vs. the characters it will cost. The Die Hard problem with the hypothetical scoring modification would have no such meta-gaming. It is a simple matter of the optimal program running the optimal solution.

That last sentence is what I have always presumed to be the mission statement of the code-golf tag.

\$\endgroup\$
7
  • 4
    \$\begingroup\$ I think optimization problems and code-golf are two different things. Code-golf is about program length, not the quality of the solution. \$\endgroup\$
    – ugoren
    Commented Feb 20, 2014 at 7:43
  • \$\begingroup\$ Does this mean I can win every question with a tiny program in GolfScript/J/Befunge/Brainf*ck that has infinite random output? You can't prove it doesn't eventually output a solution of some kind. ;-P \$\endgroup\$ Commented Feb 20, 2014 at 12:03
  • 1
    \$\begingroup\$ You can't. If the challenge is to print hello, world, then your program should print no more, no less, every time it runs. Else it doesn't qualify, regardless of its size. \$\endgroup\$
    – ugoren
    Commented Feb 20, 2014 at 12:32
  • \$\begingroup\$ Isn't "no more, no less" essentially saying the solution should be optimal? (Playing at devil's advocate here, but I think picking at the underlying assumptions Socratically is fruitful.) \$\endgroup\$ Commented Feb 20, 2014 at 14:08
  • 3
    \$\begingroup\$ It means the solution should be correct. Optimal implies that there are other correct solutions, which are not as good. But when you're required to print hello, world, anything else you print is simply incorrect. \$\endgroup\$
    – ugoren
    Commented Feb 20, 2014 at 15:15
  • \$\begingroup\$ "Hello, world!" when the question asked for "hello, world"? What about "Hello, world, my name is Adam. I made the output longer to show off how much more efficient <my-lang> is than yours. Try and beat me."? \$\endgroup\$ Commented Feb 20, 2014 at 15:33
  • 2
    \$\begingroup\$ You can argue about how strictly rules can be followed, but it still has nothing to do with optimization. It's not as if the task is to get as close as possible to hello, world. \$\endgroup\$
    – ugoren
    Commented Feb 20, 2014 at 15:36

You must log in to answer this question.

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