Rating problems and solutions

We all know and love (!) the leaderboard, but how about a different method?

One can solve a problem with a simple, naive method resulting in a short program and long runtime, or put in lots of explicit optimizations for more code and shorter runtime. (Or if you’re really good, a short, fast program!)

I propose the line-second.

Take the number of lines in your program (eg, 42 lines) and the runtime (eg 0.096 seconds). Multiply these together to get a score of 4.032 line-seconds.

A smaller score is a shorter, faster program.

Similarly, (for a particular solver), a larger score is a “harder” problem.

CameronDev,

Some of the challenges feasably could be solved with a pen and paper amd a keen eye, giving a line count of 0.

:D

exocortex,
  1. I think a more consistent approach would he to not count lines, but filesizes after the code has been minimized with a specific minimizer. I could write everything in one line in many languages, so lines isn’t very clever.
  2. The code has to be compiled and run on a specific architecture and with specific test input (we don’t know if the AoC-example-data is always the same in size or resulting computanional complexity.
  3. The final metric could be: [minified filesize] * [code execution time] * [problem solving time].
hades,

Lines of code can be arbitrarily reduced, and seconds to solve depends to a large extent on how good my hardware is. So both metrics are useless, and multiplying them makes a useless-squared metric.

I love it!

Here are my stats for the solutions so far (with no optimisation beyond the initial solution):


<span style="color:#323232;">+-----+-----------+-------+---------------+
</span><span style="color:#323232;">| Day | Time (s)  | Lines | line-seconds  |
</span><span style="color:#323232;">+-----+-----------+-------+---------------+
</span><span style="color:#323232;">|  1  |  0.003    |   35  |   0.098       |
</span><span style="color:#323232;">|  2  |  0.001    |   47  |   0.042       |
</span><span style="color:#323232;">|  3  |  0.006    |   60  |   0.348       |
</span><span style="color:#323232;">|  4  |  0.003    |   41  |   0.115       |
</span><span style="color:#323232;">|  5  |  0.077    |   74  |   5.708       |
</span><span style="color:#323232;">|  6  |  0.000    |   45  |   0.001       |
</span><span style="color:#323232;">|  7  |  0.005    |   87  |   0.395       |
</span><span style="color:#323232;">|  8  | 10.175    |   60  | 610.476       |
</span><span style="color:#323232;">|  9  |  0.004    |   31  |   0.128       |
</span><span style="color:#323232;">| 10  |  0.084    |  103  |   8.634       |
</span><span style="color:#323232;">| 11  |  0.240    |   49  |  11.771       |
</span><span style="color:#323232;">| 12  |  2.448    |   93  | 227.633       |
</span><span style="color:#323232;">| 13  |  0.009    |   83  |   0.707       |
</span><span style="color:#323232;">+-----+-----------+-------+---------------+
</span>
HeckGazer,

Another wrinkle is how do you count the lines? I’ve done several of this year’s AoC in “one line” of JavaScript because you can just chain split().map().reduce().filter() etc. together indefinitely. Some languages like JS or python can do so much in one line

lwhjp,
@lwhjp@lemmy.sdf.org avatar

I probably should have made it clearer this is a somewhat tongue-in-cheek proposal :)

You’re quite right - pretty much any program can be golfed into a single line.

Ategon,
@Ategon@programming.dev avatar

The issue with that and reason why AoC doesnt use that for the leaderboard is they dont have access to the code people write, just the final result

Adding that as an option would mean having something that takes into account differences in base runtimes of code for different languages (e.g. scripting languages taking longer) so that its feasible to code it in anything, and having the ability to execute many different kinds of code which can be a pain to set up (and would mean youre then running arbitrary code unless you sandbox it)

I used that as the way to rank people in !challenges when I was running that and its been on hiatus for awhile due to the effort needed to run it since I havent had time due to building up things in the instance such as !pangora

It could work if self reported but then its easy to cheat

lwhjp,
@lwhjp@lemmy.sdf.org avatar

Oh sure, it’s only for fun - I was thinking of it more of a way to compare my own solutions to different problems.

I didn’t notice there was a challenges community! That’s awesome. (Maybe a more casual honor-based version where anybody can submit puzzles would be easier? Creating puzzles sounds like fun!)

Ategon,
@Ategon@programming.dev avatar

Yeah ill be editing it and trying to relaunch it in the new year with a different format

  • All
  • Subscribed
  • Moderated
  • Favorites
  • advent_of_code@programming.dev
  • ngwrru68w68
  • DreamBathrooms
  • thenastyranch
  • magazineikmin
  • InstantRegret
  • GTA5RPClips
  • Youngstown
  • everett
  • slotface
  • rosin
  • osvaldo12
  • mdbf
  • kavyap
  • cubers
  • megavids
  • modclub
  • normalnudes
  • tester
  • khanakhh
  • Durango
  • ethstaker
  • tacticalgear
  • Leos
  • provamag3
  • anitta
  • cisconetworking
  • JUstTest
  • lostlight
  • All magazines