What is meta? ×
Meta Stack Exchange is where users like you discuss bugs, features, and support issues that affect the software powering all 131 Stack Exchange communities.

I have not been following code golf for very long. Obviously some languages produce naturally more concise code than others (i.e. due the language features offered, whether operators are punctuation or words, type inference, boilerplate code required, &c.).

Has anyone yet proposed the notion of a language handicap so that it is, to some degree, possible to compare solutions across languages?

The handicap could work by taking the shortest solution in each language across a set of the historical problems and calculating the average difference, in characters, in program length from the absolute shortest solution.

Answer submitters could then include both the absolute character count and the handicap-adjusted count (handicap-adjusted = actual-characters - language-handicap).

share|improve this question
11  
Since this is a [code-golf] question should we keep our answers as short as possible? :) –  user27414 Sep 2 '10 at 10:34
    
I posted a related question to the Programmers private beta last night. For those with access: programmers.stackexchange.com/questions/408/… –  Pops Sep 2 '10 at 16:37

5 Answers 5

English: 22 20 characters

Gr8 4 dedicated site

But seriously: there is already a debate going on which answer should be accepted in code-golf - the shortest, the shortest weighted as you probably would imply, the one that appeals to the OP the most, or should we be able to accept more than one?

Such a handicap would be also hard to calculate and source of much controversy.

Therefore this would be fit for a dedicated golfing site. One could measure the ratio of best answers in a certain language against each other and come up with ratios based on the body available. This cannot be done in SO though.

Code golfing is marginal in SO, usually community wiki and therefore does not count towards a posters reputation. Let the community decide which solutions they like, accept no answer (will not interfere even with your acceptance rate due to cwiki).

Now, if you want to propose a SE site on area51, one would maybe need the following changes on SE software: tagging answers (with the language used), length function on code block, method to calculate language ratios, multiple accepts on a question.

share|improve this answer
4  
+1 for "Code golfing is marginal in SO". I don't think scoring rules are worth debating on MSO. –  David Thornley Sep 2 '10 at 14:19
    
Or no accepted answers. –  Gelatin Sep 2 '10 at 15:14
    
-1; after your edit, this no longer compiles as valid English on my machine. –  Pops Sep 2 '10 at 22:11
    
@Pop: It compiled before? Errr... I mean "b4"? ;) –  Jon Seigel Sep 2 '10 at 22:30
    
@Jon, I refer you to my favorite compiler message of all time: too many errors; bailing out –  Pops Sep 3 '10 at 1:57

Has anyone yet proposed the notion of a language handicap so that it is, to some degree, possible to compare solutions across languages?

Literal interpretation of the question; shortest possible answer:

No

share|improve this answer
    
Answer does not work for all future dates, -1 (not really) –  user149432 Sep 16 '10 at 11:59

As I see it, Code Golf has two challenges:

  1. Shortest Solution
  2. Shortest Solution in language of choice

So, yes, some languages are more verbose then others, but to find the shortest solutions for those languages is a sub-challenge in my opinion.

share|improve this answer
1  
A sub-challenge? Like Hunt for Red October? –  Peter Ajtai Sep 2 '10 at 19:25

It's not workable in practice to have a fixed handicap for each language, because different languages have different aptitudes for different problems. For example, php normally sucks at golf, but for a solution which uses md5, it's great because md5 is a builtin function. Usually Perl is best, but sometimes it's Ruby.

The fact is that cross-language golf comparisons are not accurately comparable. If you want the shortest program overall, you'll just have to learn some new languages.

share|improve this answer

Code golf is a special case on Stack Overflow, and needs to be kept a simple as possible. It's a simple rules: the fewest (key)strokes wins.

share|improve this answer
    
APL ftw would be my guess. –  Peter Ajtai Sep 2 '10 at 19:23
    
@Peter J and golfscript can give APL a run for its money, and few people are any good at APL these days, so... Me, I write them in fortran or c or gawk. But I don't care if I "win" or not. –  dmckee Sep 2 '10 at 23:10
    
I've been playing a little with J recently. It's a lot of fun, but it's quite a learning curve.... maybe I'll try a few of the golf script questions sometime. –  Peter Ajtai Sep 2 '10 at 23:18

You must log in to answer this question.

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