12
\$\begingroup\$

We haven't really talked about specified language challenges.

On Stack Overflow, we asked that all problems be language agnostic, but I don't feel that we are automatically bound by that ethic here. (I am in favor of language agnosticism being the default.) Anyone have thoughts on what limits if any should be imposed on posters in terms of specifying language to be used?

Brought on by Text compression in C or C++, though I think this question has some faults outside of the author's desire to see only one or two languages used.

Some of my thoughts:

  • I suspect that any new language specific challenge posted will be followed by a nearly identical language agnostic one, and I am not sure that this is desirable.
  • To the extent that code golf is instructive, it is not unreasonable to desire instruction in a particular language.
  • Some challenges are natural in one class of languages and not in another class. For those combined heats will not inspire people to work in the "hard" ones, so perhaps a "Special Olympics" model worthwhile.
\$\endgroup\$
8
\$\begingroup\$

This fire needs some gasoline. Especially because the given example is a poor code challenge for other reasons.

I think it's great having questions that doesn't limit the choice of language, but frankly, standard golfing rules doesn't achieve that any better than a liberal definition of a car allow people, who otherwise doesn't have the means, to participate in a motor race.

Language-limited questions could help keep the sites appeal broader by allowing competitive golfing in many languages. By allowing out-of-competition submissions in other languages the freedom is practically the same.

As my question may hint, I like the "Special Olympics" concept. Choosing a language suitable for the job is such a boring way of life.

\$\endgroup\$
6
\$\begingroup\$

LiraNuna once told me that if a challenge needs artificial restrictions to make interesting (e.g., can't use specific languages, can't use eval, can't use libraries, can't call external programs, etc., etc.), then it's not a very interesting problem to begin with.

He's right. A really good code challenge doesn't care what language you use, because the cleverness is in the problem-solving techniques, not in the particular language or tools at hand.

People moan all the time about GolfScript, but I can say for sure that LiraNuna's problems are usually not won by a GolfScript submission. That's a mark of a quality question.

So, summary: If a problem is language-specific, it means one of two things:

  1. It's actually an interesting question. In that case, just make it language-agnostic! (Say I, who created the tag on Stack Overflow. ;-))
  2. It's actually a boring question. In that case, KILL IT WITH FIRE.

Comments welcome. :-)

\$\endgroup\$
  • 3
    \$\begingroup\$ Well that's partly because LiraNuna doesn't update the accepted answer :) There's quite a few of LiraNuna's older questions that have got good GS answers now. \$\endgroup\$ – gnibbler Mar 9 '11 at 5:49
4
\$\begingroup\$

I have seen 3 kinds of questions, trying to limit the number of languages:

  • ... runs on my computer, for automatic choosing the winner, for example to compare the speed of different solutions, or a speed threshold
  • The question has a feature, only available in - for example - C++ .
  • discriminating - 'I don't like golfscript' - questions.

In case a, a better solution is to use ideone for example, to test the speed. Or you have to measure your code (to run in less than a minute, for example), and have to bring or find a second source to confirm your claim. It might be difficult for exotic languages (think: Basic), but at least it is possible for everybody.

Question 2: is the problem of the quizzmaster with limited knowledge. If the quizz is hard in javascript, because he doesn't know a javascript-compiler - maybe somebody else knows. But he needn't make an explicit language restriction, if the restriction is already in the content of the question. Maybe you can solve the 8-queens-problem with scala during compile-time? I can't in scala, but I can't in C++. :)

Question 3: If you don't like golfscript, you needn't upvote it. But as a fair sportsman, you should accept it, if it is the shortest solution and you performed the riddle.

Else: ?

Conclusion: I would discourage from using language restrictions, but I can't look into the future. Maybe there are good reasons, to restrict the battle. Maybe in those cases, it is possible to make an official and inofficial winner - for example, find the silver bullet in perl - only the best perl-solution gets accepted, but silver bullets in other languages can participate out of competition.

Since people are encouraged to introduce their question first in chat, we might avoid too restricted rules.

\$\endgroup\$
  • 1
    \$\begingroup\$ It's easy enough to handicap golfscript. Eg use floats in the input/output or use trig functions etc. Problem is that the people who don't like golfscript, probably have never tried to program it, so don't know it's weaknesses \$\endgroup\$ – gnibbler Nov 15 '13 at 1:34
  • \$\begingroup\$ Warning: The current rules does not allow any sites that have variable running time (TIO is an example) (that is, you have to run on your computer) \$\endgroup\$ – user202729 May 8 '18 at 16:13
4
\$\begingroup\$

I view each challenge as a set of challenges — one for each language. That's why the title to my solutions (I've only done a few so far) contain the character count and the language, as do most solutions.

If I write a solution in SQL, I'm not competing against other languages, I'm competing against myself and against other SQL entries.
If I wanted to try for the overal smallest solution, I probably should learn APL or GolfScript, but I'm not going to for now. I also know that Ruby or Python will beat a SQL solution easily 1. But I don't care. I might tire of SQL solutions and try Prolog (which can be surprisingly terse). But whatever langauge I choose, I'm having fun pushing the limits of the language I chose.

So it's no surprise I'm all for language agnosticism.

That having been said, I think it can be interesting to restrict the challenge to use a little used language or group of languages, like brainfuck, or 'all non-visual Basics'. Why? Because that's a challenge in itself. It promotes diversity. If a challenge is restricted to the C-family (either strict or expanded), I'll probably go 'meh' and not even read the challenge, much less the solutions. But if the challenge asks for Malbolge, I'll read every entry, even though I'll probably understand not on iota of them.

So I'm not against language specific entries either, as long as it's not restricted to a commonly used language.


1: Unless we use operator count instead of character count, which might be an interesting idea.
Edit: I see that exactly this has been proposed, in the form of Atomic Code Golf.

\$\endgroup\$
  • \$\begingroup\$ Re your footnote: I think that the definition of "operator" in the context of SQL might be controversial. \$\endgroup\$ – Peter Taylor Jan 15 '14 at 10:12
  • \$\begingroup\$ @PeterTaylor Perhaps I should've said 'keyword', but what remains is that SELECT would remain the same concept even if it was renamed to SELECTALIFRAGILISTICEXPIALIDOCIOUS, so it would count as 1, not 6 or 34. Also, since there are so many key_words_, whitespace is an important factor. \$\endgroup\$ – SQB Jan 15 '14 at 11:09
3
\$\begingroup\$

I think restricting questions to a particular language has never worked that well. For a site this size, you're likely to get very few answers at all.

For language agnostic questions, you'll often see different ideas/approaches bouncing back and forth between different answers/languages so having answers in multiple languages probably improves the best answer in what ever language(s) the asker is most interested in.

This question raises an interesting point about classes of language. For example stack based languages. I don't agree that the answers should be limited to stack based languages, but it can be added to the objective criteria. ie. "shortest code in a stack based language"

\$\endgroup\$
  • 1
    \$\begingroup\$ or perhaps make rules that would make it difficult to win with a non-stack based language. Something like -50% score for using a stack? \$\endgroup\$ – Cruncher Nov 15 '13 at 15:07

You must log in to answer this question.

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