Your task - if you accept it - is to write a program which helps understanding my proposal on meta by calculating the winner of a code-golf-reversed competition. Of course, answers to this question will be treated as proposed, so your program (if correct) can calculate whether your answer will become the accepted answer.
Rules
- The program reads a file with multiple lines of the following format (see example below): [Language] TAB [NumberOfCharacters] TAB [LinkToAnswer]
- The file name is passed as an argument to your program or the file is redirected to standard input of your program. It's your choice, please mention the method when giving the answer
- It's expected that the input format is correct. There's no need for error handling.
- The number of characters is positive. Your program must handle lengths up to 65535. 64k should be enough for everybody :-)
- The program outputs those lines on standard output which meet the idea of the meta proposal, that is
- the shortest code of a particular programming language wins (reduction phase)
- the longest code among all programming languages wins (sorting phase)
- in case of a draw, all answers with the same length shall be printed
- The order of the output is not important
- Although the longest code wins, this is not code-bowling. Your code must be as short as possible for your programming language.
- Answers on seldom programming languages which are not attempting to shorten the code deserve a downvote, because they try to bypass the intention of this kind of question. If there's only one answer for a specific programming language, it would be considered as a winner candidate, so you could start blowing its code.
Example input file (separated by single tabs if there should be an issue with formatting):
GolfScript 34 http://short.url/answer/ags
GolfScript 42 http://short.url/answer/gsq
C# 210 http://short.url/answer/cs2
Java 208 http://short.url/answer/jav
C# 208 http://short.url/answer/poi
J 23 http://short.url/answer/jsh
Ruby 67 http://short.url/answer/rub
C# 208 http://short.url/answer/yac
GolfScript 210 http://short.url/answer/210
Expected output (order is not important):
C# 208 http://short.url/answer/poi
C# 208 http://short.url/answer/yac
Java 208 http://short.url/answer/jav
Update
Some programs rely on the fact that there is a single maximum (like the C# 210 character program). Derived from reality, someone can also write a GolfScript program with 210 characters. The output would remain the same. I have added such a GolfScript to the input.
Update 2
As suggested I have retagged (still code-golf as well) and the deadline is 2014-03-06 (which looks like an arbitrary date, but I'll be back to Germany from travelling then).
Final results
I decided to vote like the following:
- Answers where the number of characters cannot be confirmed get a comment to explain the count.
- Answers which can easily be reduced get a comment, an edit suggestion and go into the result with the lower count value. (Hopefully I have seen that in advance).
- Answers which do not compile get a downvote. (Quite a hard task as it turns out).
- Answers which are not golfed get a downvote (as described in the rules already).
- Answers which produce expected output get an upvote. Due to some answers which do not work as expected, I use 4 different input files and check against the expected result.
Finally, the winner is determined by providing the qualifying answers table as input to my reference program (plus double checking the result manually). If my own answer would be the winning one, I'd exclude it from the list. In case of several winners, I would have to pick only one. Therefore, some bonuses can be earned:
- answers which accept more input than expected (e.g. outside the defined ranges)
- answers which use a clever idea of making it short
I have taken a snapshot of the answers on 6th of March 2014, 19:45 UTC+1. The analysis is ongoing. Checking all the answers is harder than expected...